test-playbook works

This commit is contained in:
Edwin Zhang 2022-07-31 03:35:07 -04:00
parent 89b4d69f27
commit efe0052016
3 changed files with 39 additions and 10 deletions

26
README
View File

@ -6,10 +6,30 @@
Ansible playbooks of the University of Waterloo Computer Science Club.
** Usage **
To run a playbook and request a user's ssh/sudo password:
** 2022 Playbook Modernization **
If a playbook is not in this list, it is not guaranteed to work.
- [x] test-playbook.yml
`ansible-playbook -kK -b test-playbook.yml`
** Deps **
1. Install pipx
```
sudo apt install python3-pip python3-venv
python3 -m pip install --user pipx
python3 -m pipx ensurepath
```
2. Install ansible and ansible-lint
```
pipx install --include-deps ansible
pipx install ansible-lint
```
** Usage **
To run a playbook and request a user's sudo password:
`ansible-playbook test-playbook.yml`
** OLD **
To run a playbook as a different user (for example to provision a new system
that doesn't have sssd yet):

View File

@ -13,8 +13,10 @@ log_path = ansible.log
# Plugins
callback_plugins = plugins/callback/log_plays/
#callback_plugins = plugins/callback/log_plays/
[ssh_connection]
#ssh_args = -o ServerAliveInterval=30 -o ControlMaster=no
[privilege_escalation]
become_ask_pass= True

View File

@ -1,6 +1,13 @@
---
- hosts: all
become: yes
tasks:
- name: whoami
command: whoami
- name: Test become
hosts: all
become: true
tasks:
- name: Run whoami
ansible.builtin.command: whoami
register: result
when: true # keep the linter happy
- name: Print result
ansible.builtin.debug:
var: result.stdout