Skip to content

Commit

Permalink
Add newserver ansible playbook to run once on new servers
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Ansell <[email protected]>
  • Loading branch information
ansell authored and djtfmartin committed Mar 23, 2021
1 parent 36f7b9c commit c1fce84
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ansible/newserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Use this playbook once on a new server to install python2 and python3
# must pass target var e.g. ansible-playbook newserver.yml -i /path/to/inventories/your-inventory-file -u ${USER} --private-key=~/.ssh/id_rsa --extra-vars 'target=bla-bla'
- hosts: '{{ target }}'
gather_facts: false
pre_tasks:
- name: Install python2 and python3 for Ansible
raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt-get install -qqy python3-minimal 'python2.*-minimal')"
register: output
changed_when: output.stdout != ""
- name: Gathering Facts
setup:
become: yes

0 comments on commit c1fce84

Please sign in to comment.