-
Notifications
You must be signed in to change notification settings - Fork 2
/
install-sudo.yml
41 lines (36 loc) · 1.38 KB
/
install-sudo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#* This playbook wrapps the apt (and others maybe in the future..) module
#* to install software considered basic here - i.e. to be installed on every
#* host (non minimal/embedded..). It is the first one in the row and thus
#* has no dependencies.
#* Use '-a' to pass parameters to ansible (as '-e'). See ansible fetch for
#* details.
#* No arguments are mandatory.
# Get the host ready for ansible, only 'raw' method is available..
- hosts: os.debian.stretch
become: true
become_method: "su"
gather_facts: false
tasks:
- name: "Make sure python2 is installed on this debian host: check for the command"
raw: 'test -e {{ ansible_python_interpreter }}'
ignore_errors: true
register: is_python_installed
- name: "Make sure python2 is installed on this debian host: install it if necessary"
raw: 'apt -y update && apt install -y python2'
when: is_python_installed.rc != 0
- hosts: os.debian_stretch os.debian_buster os.debian_bullseye os.debian_bullseye os.debian_bookworm &app.sudo
become: true
become_method: "su"
roles:
- inofix.yapkg
vars:
- yapkg__task_group_name: 'sudo for ansible'
- yapkg__names:
- 'sudo'
# not enabling this yet, as it only tracks 'today'
# it is only useful for human communication and needs
# to be combined with something smarter as
# dpkg --get-selections
#- hosts: all
# roles:
# - track-packages