-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaws_creds.yml
60 lines (52 loc) · 2.05 KB
/
aws_creds.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
- hosts: tag_AnsibleGroup_bastions
gather_facts: true
become: true
tasks:
- name: Install required packages
yum:
name: "python,python-pip,python-devel,gcc"
state: latest
- name: Install tower-cli
pip:
name: ansible-tower-cli
state: latest
- name: List key files
shell: (cd /root/.ssh; find . -maxdepth 1 -type f -iname '*key.pem')| cut -d'/' -f2
register: file_to_copy
- name: Tower Creds key file
tower_credential:
name: Creds for AWS instances
organization: Default
state: present
kind: ssh
tower_host: tower1.{{tower_guid}}.example.opentlc.com
tower_username: admin
tower_password: r3dh4t1!
ssh_key_data: "/root/.ssh/{{ file_to_copy.stdout }}"
username: ec2-user
# - name: Update Prod Job template
# tower_job_template:
# name: "3 tier app on Prod"
# machine_credential: "Creds for AWS instances"
# tower_host: tower1.{{tower_guid}}.example.opentlc.com
# tower_username: admin
# tower_password: r3dh4t1!
# state: present
# job_type: run
# playbook: site-3tier-app.yml
# project: "Homework Assignment"
# - name: Update Prod Smoke Job template
# tower_job_template:
# name: "Smoke test Prod env"
# machine_credential: "Creds for AWS instances"
# tower_host: tower1.{{tower_guid}}.example.opentlc.com
# tower_username: admin
# tower_password: r3dh4t1!
# state: present
# job_type: run
# playbook: site-smoketest-aws.yml
# project: "Homework Assignment"
- name: Update Prod Job template
command: tower-cli job_template modify --project="Homework Assignment" --credential="Creds for AWS instances" -n "3 tier app on Prod" -p "r3dh4t1!" -u admin -h "tower1.{{tower_guid}}.example.opentlc.com"
- name: Update Prod Smoke Job template
command: tower-cli job_template modify --project="Homework Assignment" --credential="Creds for AWS instances" -n "Smoke test Prod env" -p "r3dh4t1!" -u admin -h "tower1.{{tower_guid}}.example.opentlc.com"