Added playbook for setting up Docker + other usefull services on the NCAFSA VM template.
This commit is contained in:
parent
a83635f4bf
commit
da543234a1
22
dnaclab_linux/prestage_ncafsa_vm_template.yml
Normal file
22
dnaclab_linux/prestage_ncafsa_vm_template.yml
Normal file
@ -0,0 +1,22 @@
|
||||
# 12/07/2023 - Sets up the target hosts with the basic necessary packages and Docker and
|
||||
# adds the users to the Docker group.
|
||||
---
|
||||
- name: Prestage server(s) with the following roles {{ ansible_play_role_names }}
|
||||
hosts: staging
|
||||
roles:
|
||||
- common
|
||||
- ncafsa-vm-template
|
||||
- ncafsa-users
|
||||
become: yes
|
||||
vars_files:
|
||||
- global_vars/main.yml
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Send Webex Teams message via BOT to confirm playbook completion
|
||||
community.general.cisco_webex:
|
||||
recipient_type: toPersonEmail
|
||||
recipient_id: "{{ webex_id }}"
|
||||
msg_type: markdown
|
||||
personal_token: "{{ webex_token }}"
|
||||
msg: "**Prestaging has been completed for host {{ inventory_hostname }}.**"
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Prestage server(s) with the NCA Automation team users
|
||||
hosts: kubernetes-dev
|
||||
hosts: staging
|
||||
roles:
|
||||
- ncafsa-users
|
||||
become: yes
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
38336538336630386430306665313035623039376166353938363662653765643037656338653730
|
||||
3166343061396430326336626332333635316438313536340a353134623836626638663465653631
|
||||
35636263393739623736326466616161333832323338653365303466636465383462326239333665
|
||||
3863323733646437370a333036613539626134316633633436393364393530613265636539376232
|
||||
62633338663131373330323337306664343665666336376534353830316131373339636337396134
|
||||
38663332313438303439313632363838353635393630316633623933353035363761366531613537
|
||||
32383938656133613961383231316632313231333634353566363430653934653138383465313737
|
||||
39396334396663336536666566616336623832316562653265643461396435613166346337616138
|
||||
62326639393665303866626332316334633963663636303964613632366162643933343163323133
|
||||
38663964613862306331383934333234303630653536323564366563356663666663333630343435
|
||||
35313639376164336661623933396664653036316634663831386433383030393232313063666632
|
||||
38363637363332646436313966383466656538336566326136343964353934653965336562643635
|
||||
30343631366563343739373462343434636338393564613736313539303933303035326539366235
|
||||
66313133336636653865376263326433353332303435336634356262316166613533663636643066
|
||||
33386432313639316233366134306263613665363632316664613134323633393464666330393233
|
||||
30366538326237383036363836656535323636313934613239616136386538643139616665356664
|
||||
64376433353362346163623938653539613436383465333733663161383964623765653534666236
|
||||
34656331393837306564623131363131383530386433326533633638363366366130393638643262
|
||||
64626463626566653864323565323265306437636162353631666463316532346466326464636264
|
||||
66383433646131393963346664353165666237306665616230646536616531353161666433353332
|
||||
36646636663265633761636134613765346665353863333864333931316339353333356537663830
|
||||
36343636303635353766626531313537303134306332326563376337353733336137636433666362
|
||||
37326463333838343135393430393831383536646464353135636532373438656366303664323562
|
||||
38343438626635326636346336383034376337353237393065386530643466663733626564303036
|
||||
6537
|
||||
63616133626234653365316361623861623664336263343332373439326135383930613839663133
|
||||
6462633664616563316263663430366231396634363465650a656430616139313938373832333332
|
||||
33623733393732376134636564356138303463333662326162393238326566343265373763646239
|
||||
3064326661643134360a313335613133396164353435336330643035393430303135646361386433
|
||||
35366534383962326536343531613261626433613631623233383238646565396337366634343439
|
||||
30633462653730613534386338653062383466326666633738303031363339646361656132303133
|
||||
38333139663963616632363436353431326231343164313661613431386235633734666266643837
|
||||
62623265326334613238356462633334613037643262626238333334666436393333393937633034
|
||||
38666566636330303632636637383731336161313639386336633964323637373137343032333761
|
||||
66613537396630373133646130316230363335653231633033376334633236613762336136346434
|
||||
32346166376363336463633234326166653763393732646232626461376536346266346633633266
|
||||
31366535366233663439306261383963666463633034643366346132396435303430636466656565
|
||||
34326334383661393737363666326434643031373562396534313033313136666133343963356239
|
||||
35333062636466643630653535666661653534353461633037326435626537393466353832366638
|
||||
39383764643339653266323533623166303434613739393466333362653563366366393135373039
|
||||
62393133333839663666646362663235666634303439653664316536386532363531376161396463
|
||||
38383363363163656663356336336331366439626634643466623463333030636238353961623234
|
||||
64646230323235646136646262363634306135613637323533383038643764323432376139396631
|
||||
32373837666335653530383530613137393637316532663534376164646131636138333162363339
|
||||
34666631623838666337356133643964363966306239323561636237343662626361656434353034
|
||||
31383238356137656465363866633631343435363936646264333263313964666437663734616462
|
||||
34366539636234326264346261383262353739356530336138643161383463343836623435376364
|
||||
61633932353863323336353963356363376337643930373131383935636332643832646330376363
|
||||
36613130623634356232336637373565613635366137353637386662653137323166666565393665
|
||||
3637
|
||||
|
||||
47
dnaclab_linux/roles/ncafsa-vm-template/tasks/main.yaml
Normal file
47
dnaclab_linux/roles/ncafsa-vm-template/tasks/main.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
- name: Install aptitude
|
||||
ansible.builtin.apt:
|
||||
name: aptitude
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Install required packages
|
||||
ansible.builtin.apt:
|
||||
pkg:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- curl
|
||||
- software-properties-common
|
||||
- python3-pip
|
||||
- virtualenv
|
||||
- python3-setuptools
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Add Docker GPG apt Key
|
||||
ansible.builtin.apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
|
||||
- name: Add Docker Repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: deb https://download.docker.com/linux/ubuntu focal stable
|
||||
state: present
|
||||
|
||||
- name: Update apt and install docker-ce
|
||||
ansible.builtin.apt:
|
||||
name: docker-ce
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Run default container to test Docker install
|
||||
community.docker.docker_container:
|
||||
name: test_container
|
||||
image: hello-world
|
||||
state: present
|
||||
|
||||
- name: Add users to Docker group (allows running Docker commands without sudo)
|
||||
ansible.builtin.user:
|
||||
name: "{{ item.key }}"
|
||||
groups: "sudo, docker"
|
||||
loop: "{{ lookup('dict', users) }}"
|
||||
Loading…
Reference in New Issue
Block a user