Skip to content
This repository was archived by the owner on Jul 4, 2023. It is now read-only.

Commit 22b0e2c

Browse files
author
Riaan Nolan
committedJan 31, 2023
Merge branch 'feature/update-ansible-awx-tower-version' into 'master'
Feature/update ansible awx tower version See merge request all-staff/hashiqube!147
1 parent e2b12ec commit 22b0e2c

File tree

2 files changed

+42
-35
lines changed

2 files changed

+42
-35
lines changed
 

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ A Very special mention to HashiQube's contributors, Thank You All for your help,
244244
- Greg Luxford
245245
- Byron Tuckett
246246
- Lane Birmingham
247+
- Devang Dhameliya
248+
- Rajesh Cholleti
247249

248250
## Videos
249251
Videos were made with asciinema https://asciinema.org/

‎ansible-tower/ansible-tower.sh

+40-35
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# https://github.com/ansible/awx/blob/devel/tools/docker-compose/README.md
77
# https://github.com/ansible/awx
88
# https://blog.palark.com/ready-to-use-commands-and-tips-for-kubectl/
9+
# https://techfrontier.me.uk/post/finally-my-own-awx-server/
910

1011
echo -e '\e[38;5;198m'"++++ "
1112
echo -e '\e[38;5;198m'"++++ Add ~/.local/bin to PATH"
@@ -40,6 +41,14 @@ sudo --preserve-env=PATH -u vagrant python -m pip install molecule --quiet
4041
sudo --preserve-env=PATH -u vagrant python -m pip install junit_xml --quiet
4142
sudo --preserve-env=PATH -u vagrant python -m pip install awxkit --quiet
4243

44+
# BUG: https://techfrontier.me.uk/post/finally-my-own-awx-server/
45+
# Back-off pulling image "quay.io/ansible/awx-ee:latest"
46+
# This looks to relate image "quay.io/ansible/awx-ee:latest" being large and not pulling quick enough, so we manually intervene and get it into our docker library by hand.
47+
echo -e '\e[38;5;198m'"++++ "
48+
echo -e '\e[38;5;198m'"++++ Pull quay.io/ansible/awx-ee:latest to avoid Back-off pulling image later"
49+
echo -e '\e[38;5;198m'"++++ "
50+
sudo --preserve-env=PATH -u vagrant minikube ssh docker pull quay.io/ansible/awx-ee:latest
51+
4352
# https://github.com/ansible/awx-operator#basic-install
4453
echo -e '\e[38;5;198m'"++++ "
4554
echo -e '\e[38;5;198m'"++++ Create kustomization.yaml"
@@ -49,17 +58,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1
4958
kind: Kustomization
5059
resources:
5160
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
52-
- github.com/ansible/awx-operator/config/default?ref=0.30.0
61+
- github.com/ansible/awx-operator/config/default?ref=1.1.4
5362
5463
# Set the image tags to match the git version from above
5564
images:
5665
- name: quay.io/ansible/awx-operator
57-
newTag: 0.30.0
66+
newTag: 1.1.4
5867
5968
# Specify a custom namespace in which to install AWX
6069
namespace: awx
6170
EOF
62-
cat ./kustomization.yaml
6371

6472
echo -e '\e[38;5;198m'"++++ "
6573
echo -e '\e[38;5;198m'"++++ Create awx.yaml with kubectl kustomize > awx.yaml"
@@ -74,7 +82,7 @@ sudo --preserve-env=PATH -u vagrant kubectl apply -f awx.yaml
7482

7583
# https://github.com/ansible/awx/blob/17.0.1/INSTALL.md#post-install-1
7684
attempts=0
77-
max_attempts=15
85+
max_attempts=20
7886
while ! ( sudo --preserve-env=PATH -u vagrant kubectl get pods --namespace awx | grep controller | tr -s " " | cut -d " " -f3 | grep Running ) && (( $attempts < $max_attempts )); do
7987
attempts=$((attempts+1))
8088
sleep 60;
@@ -95,15 +103,13 @@ kind: AWX
95103
metadata:
96104
name: awx-demo
97105
spec:
106+
ee_images:
107+
- name: quay.io/ansible/awx-ee:latest
108+
image: quay.io/ansible/awx-ee:latest
98109
service_type: nodeport
99110
# default nodeport_port is 30080
100111
nodeport_port: 30080
101-
# Set the image tags to 0.6.0 because latest tag is 632.1 mb (heavy to pull) from above
102-
images:
103-
- name: quay.io/ansible/awx-ee
104-
newTag: 0.6.0
105112
EOF
106-
cat ./awx-demo.yaml
107113

108114
echo -e '\e[38;5;198m'"++++ "
109115
echo -e '\e[38;5;198m'"++++ Add awx-demo.yaml to kustomization.yaml"
@@ -113,18 +119,17 @@ apiVersion: kustomize.config.k8s.io/v1beta1
113119
kind: Kustomization
114120
resources:
115121
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
116-
- github.com/ansible/awx-operator/config/default?ref=0.30.0
122+
- github.com/ansible/awx-operator/config/default?ref=1.1.4
117123
- awx-demo.yaml
118124
119125
# Set the image tags to match the git version from above
120126
images:
121127
- name: quay.io/ansible/awx-operator
122-
newTag: 0.30.0
128+
newTag: 1.1.4
123129
124130
# Specify a custom namespace in which to install AWX
125131
namespace: awx
126132
EOF
127-
cat ./kustomization.yaml
128133

129134
echo -e '\e[38;5;198m'"++++ "
130135
echo -e '\e[38;5;198m'"++++ Create awx.yaml with kubectl kustomize > awx.yaml"
@@ -137,7 +142,7 @@ echo -e '\e[38;5;198m'"++++ "
137142
sudo --preserve-env=PATH -u vagrant kubectl apply -f awx.yaml
138143

139144
attempts=0
140-
max_attempts=15
145+
max_attempts=20
141146
while ! ( sudo --preserve-env=PATH -u vagrant kubectl get pods --namespace awx | grep demo | grep -v postgres | tr -s " " | cut -d " " -f3 | grep Running ) && (( $attempts < $max_attempts )); do
142147
attempts=$((attempts+1))
143148
sleep 60;
@@ -158,7 +163,7 @@ echo -e '\e[38;5;198m'"++++ "
158163
echo -e '\e[38;5;198m'"++++ Check that AWX Ansible Tower web interface is available"
159164
echo -e '\e[38;5;198m'"++++ "
160165
attempts=0
161-
max_attempts=15
166+
max_attempts=20
162167
while ! ( kubectl exec $(kubectl get po -n awx | grep -v operator | grep -v postgres | grep awx | tr -s " " | cut -d " " -f1) --container="redis" -n awx -- /bin/bash -c "apt-get -qqq update && apt-get -qqq install -y procps curl net-tools && netstat -nlp | grep 8052" ) && (( $attempts < $max_attempts )); do
163168
attempts=$((attempts+1))
164169
sleep 60;
@@ -167,7 +172,7 @@ while ! ( kubectl exec $(kubectl get po -n awx | grep -v operator | grep -v post
167172
done
168173

169174
attempts=0
170-
max_attempts=15
175+
max_attempts=20
171176
while ! ( sudo netstat -nlp | grep 8043 ) && (( $attempts < $max_attempts )); do
172177
attempts=$((attempts+1))
173178
sleep 60;
@@ -244,36 +249,36 @@ echo -e '\e[38;5;198m'"++++ Add credentials ansible"
244249
echo -e '\e[38;5;198m'"++++ "
245250
sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx credentials create --credential_type 'Machine' --organization 'Default' --name 'ansible' --inputs '{"username": "vagrant", "password": "vagrant"}' $AWX_COMMON
246251

247-
# https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-job-templates
248-
echo -e '\e[38;5;198m'"++++ "
249-
echo -e '\e[38;5;198m'"++++ Associate credential with job_templates Demo Job Template"
250-
echo -e '\e[38;5;198m'"++++ "
251-
sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx job_templates disassociate --credential "Demo Credential" --name "Demo Job Template" --wait $AWX_COMMON || true
252-
sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx job_templates associate --credential "ansible" --name "Demo Job Template" --wait $AWX_COMMON || true
252+
# # https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-job-templates
253+
# echo -e '\e[38;5;198m'"++++ "
254+
# echo -e '\e[38;5;198m'"++++ Associate credential with job_templates Demo Job Template"
255+
# echo -e '\e[38;5;198m'"++++ "
256+
# sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx job_templates disassociate --credential "Demo Credential" --name "Demo Job Template" --wait $AWX_COMMON || true
257+
# sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx job_templates associate --credential "ansible" --name "Demo Job Template" --wait $AWX_COMMON || true
253258

254259
# https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-job-templates
255260
echo -e '\e[38;5;198m'"++++ "
256261
echo -e '\e[38;5;198m'"++++ Associate credential with job_templates ansible-role-example-role"
257262
echo -e '\e[38;5;198m'"++++ "
258263
sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx job_templates associate --credential "ansible" --name "ansible-role-example-role" $AWX_COMMON
259264

260-
# https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-projects-update
261-
echo -e '\e[38;5;198m'"++++ "
262-
echo -e '\e[38;5;198m'"++++ Update the project"
263-
echo -e '\e[38;5;198m'"++++ "
264-
sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx projects update "Demo Project" --wait $AWX_COMMON
265+
# # https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-projects-update
266+
# echo -e '\e[38;5;198m'"++++ "
267+
# echo -e '\e[38;5;198m'"++++ Update the project"
268+
# echo -e '\e[38;5;198m'"++++ "
269+
# sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx projects update "Demo Project" --wait $AWX_COMMON
265270

266-
# https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-projects-modify
267-
echo -e '\e[38;5;198m'"++++ "
268-
echo -e '\e[38;5;198m'"++++ Disable project update"
269-
echo -e '\e[38;5;198m'"++++ "
270-
sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx projects modify 'Demo Project' --scm_update_on_launch false --wait $AWX_COMMON
271+
# # https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-projects-modify
272+
# echo -e '\e[38;5;198m'"++++ "
273+
# echo -e '\e[38;5;198m'"++++ Disable project update"
274+
# echo -e '\e[38;5;198m'"++++ "
275+
# sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx projects modify 'Demo Project' --scm_update_on_launch false --wait $AWX_COMMON
271276

272277
# https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-workflow-job-templates-modify
273-
echo -e '\e[38;5;198m'"++++ "
274-
echo -e '\e[38;5;198m'"++++ Modify job_templates Demo Job Template"
275-
echo -e '\e[38;5;198m'"++++ "
276-
sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx job_templates modify "Demo Job Template" --name "Demo Job Template" --ask_limit_on_launch true --ask_tags_on_launch true $AWX_COMMON
278+
# echo -e '\e[38;5;198m'"++++ "
279+
# echo -e '\e[38;5;198m'"++++ Modify job_templates Demo Job Template"
280+
# echo -e '\e[38;5;198m'"++++ "
281+
# sudo --preserve-env=PATH -u vagrant /home/vagrant/.local/bin/awx job_templates modify "Demo Job Template" --name "Demo Job Template" --ask_limit_on_launch true --ask_tags_on_launch true $AWX_COMMON
277282

278283
echo -e '\e[38;5;198m'"++++ "
279284
echo -e '\e[38;5;198m'"++++ Configure SSH to allow login with password"

0 commit comments

Comments
 (0)
This repository has been archived.