prakhar
2018-07-27 28122a635b681313290b105731c7a0506f441713
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
- name: Install required packages 
  yum: 
     name: "{{item}}"
     state: latest 
  with_items: 
    - python 
    - python-pip 
    - python-devel 
    - gcc
- name: Install tower-cli
  pip:
    name: ansible-tower-cli
    state: latest
 
- name: Configure the tower cli file
  template:
    src: tower_cli.j2
    dest: "~/.tower_cli.cfg"
    mode: 0600
 
- name: Append file
  lineinfile:
    path: /root/license.txt
    insertbefore: '"company_name.*"'
    line: '"eula_accepted" : "true",'
 
- name: Add the tower license 
  command: |
    tower-cli setting modify LICENSE @/root/license.txt
 
- name: Copy read only credentials
  template:
    src: read_only.json
    dest: /tmp/read_only.json
- name: Remove License file
  file:
    path: /root/license.txt
    state: absent
- name: inject aws read-only credentials into tower
  shell: tower-cli credential create --credential-type 'Amazon Web Services' --name "AWS Access Key"  --organization Default --inputs @/tmp/read_only.json 
 
 
- name: Remove access key file
  file:
    path: /tmp/read_only.json
    state: absent