-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathazure-cli.yml
72 lines (63 loc) · 2.14 KB
/
azure-cli.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
61
62
63
64
65
66
67
68
69
70
71
- name: Azure CLI | Pre-Reqs
hosts: localhost
become: true
vars:
rhsm_repos:
- rhel-7-server-rpms
- rhel-7-server-extras-rpms
- rhel-7-server-ose-3.10-rpms
- rhel-7-fast-datapath-rpms
- rhel-7-server-ansible-2.5-rpms
rhsm_repos_disable:
- rhel-7-server-htb-rpms
- rhel-7-server-ose-3.9-rpms
message: |
This host is now setup, next steps are
Login
- az login
Create Service Principal if one isn't available
- az ad sp create-for-rbac --name ServicePrincipalName --password PASSWORD
Copy vars.yml.example to vars.yml
- cp vars.yml.example vars.yml
Edit vars.yml
- vi vars.yml
tasks:
- name: Setup | Disable RHSM repositories
rhsm_repository:
name: "{{ rhsm_repos_disable }}"
state: disabled
- name: Setup | Enable RHSM repositories
rhsm_repository:
name: "{{ rhsm_repos }}"
state: enabled
- name: Setup | Import Microsft RPM key
rpm_key:
state: present
key: https://packages.microsoft.com/keys/microsoft.asc
- name: Setup | Check for exisiting Microsoft yum repo
stat:
path: /etc/yum.repos.d/azure-cli.repo
register: repo_check
- name: Setup | Install CLI yum repo
shell: sh -c 'echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
when: not repo_check.stat.exists
- name: Setup | Install required packages
yum:
name: "{{ item }}"
state: latest
loop:
- https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- python2-pip
- azure-cli
- atomic-openshift-clients
- openshift-ansible
- name: Setup | Remove epel
yum:
name: epel-release
state: absent
- name: Setup | Install Azure ansible pip modules
pip:
name: ansible[azure]
- name: Setup | Prompt
debug:
msg: "{{ message.split('\n') }}"