test-playbook works

pull/14/head
Edwin Zhang 4 months ago
parent 89b4d69f27
commit efe0052016
  1. 26
      README
  2. 4
      ansible.cfg
  3. 17
      test-playbook.yml

@ -6,10 +6,30 @@
Ansible playbooks of the University of Waterloo Computer Science Club.
** 2022 Playbook Modernization **
If a playbook is not in this list, it is not guaranteed to work.
- [x] 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 ssh/sudo password:
To run a playbook and request a user's sudo password:
`ansible-playbook test-playbook.yml`
`ansible-playbook -kK -b 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):
@ -18,4 +38,4 @@ that doesn't have sssd yet):
To run a playbook starting at a certain spot:
`ansible-playbook -kK -b install-office-terminal.yml --start-at-task='enable magic sysrq'`
`ansible-playbook -kK -b install-office-terminal.yml --start-at-task='enable magic sysrq'`

@ -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

@ -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

Loading…
Cancel
Save