Skip to content

Commit 22d8b8c

Browse files
committed
Add newserver ansible playbook to run once on new servers
Signed-off-by: Peter Ansell <p_ansell@yahoo.com>
1 parent 3f2f9b8 commit 22d8b8c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ansible/newserver.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
# Use this playbook once on a new server to install python2 and python3
3+
# 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'
4+
- hosts: '{{ target }}'
5+
gather_facts: false
6+
pre_tasks:
7+
- name: Install python2 and python3 for Ansible
8+
raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt-get install -qqy python3-minimal 'python2.*-minimal')"
9+
register: output
10+
changed_when: output.stdout != ""
11+
- name: Gathering Facts
12+
setup:
13+
become: yes
14+

0 commit comments

Comments
 (0)