Added basic Linux server prestage playbook + reboot playbook
This commit is contained in:
parent
26f5d909cc
commit
8efdffa137
@ -1,3 +1,3 @@
|
||||
all:
|
||||
hosts:
|
||||
172.16.1.112
|
||||
172.16.1.112:
|
||||
@ -1,17 +0,0 @@
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- common
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Update apt cache and install required packages
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
update_cache: yes
|
||||
loop:
|
||||
- curl
|
||||
- tree
|
||||
- syslog-ng
|
||||
- vsftpd
|
||||
- tftpd-hpa
|
||||
76
linux-ubuntu/prestage.yml
Normal file
76
linux-ubuntu/prestage.yml
Normal file
@ -0,0 +1,76 @@
|
||||
---
|
||||
- name: Prestage server and install services [SYSLOG, FTP, TFTP, NTP]
|
||||
hosts: all
|
||||
roles:
|
||||
- common
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Update and upgrade current packages
|
||||
apt:
|
||||
update_cache: yes
|
||||
upgrade: yes
|
||||
|
||||
- name: Update apt cache and install required packages
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- curl
|
||||
- tree
|
||||
- syslog-ng
|
||||
- vsftpd
|
||||
- tftpd-hpa
|
||||
- ntp
|
||||
- ufw
|
||||
|
||||
- name: Create a new regular user with sudo privileges
|
||||
user:
|
||||
name: "{{ create_user }}"
|
||||
state: present
|
||||
groups: sudo
|
||||
append: true
|
||||
create_home: true
|
||||
shell: /bin/bash
|
||||
|
||||
- name: Set authorized key for remote user
|
||||
authorized_key:
|
||||
user: "{{ create_user }}"
|
||||
state: present
|
||||
key: "{{ copy_local_key }}"
|
||||
|
||||
- name: Configure UFW to allow inbound NTP, SSH, SYSLOG, FTP connections
|
||||
ufw:
|
||||
rule: allow
|
||||
direction: in
|
||||
port: "{{ item.port }}"
|
||||
proto: "{{ item.proto }}"
|
||||
loop:
|
||||
- port: '22'
|
||||
proto: tcp
|
||||
- port: '123'
|
||||
proto: udp
|
||||
- port: '514'
|
||||
proto: udp
|
||||
- port: '23'
|
||||
proto: tcp
|
||||
|
||||
- name: UFW - Deny all other incoming traffic by default
|
||||
ufw:
|
||||
state: enabled
|
||||
policy: deny
|
||||
direction: incoming
|
||||
|
||||
- name: Block all IPv6 incoming connections
|
||||
ufw:
|
||||
rule: block
|
||||
direction: in
|
||||
proto: ipv6
|
||||
|
||||
- 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 }}.**"
|
||||
14
linux-ubuntu/reboot.yml
Normal file
14
linux-ubuntu/reboot.yml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Reboots linux host and checks status
|
||||
hosts: all
|
||||
roles:
|
||||
- common
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Rebooting...
|
||||
reboot:
|
||||
reboot_timeout: 60
|
||||
msg: Reboot issued by Ansible
|
||||
test_command: whoami
|
||||
@ -1,10 +1,25 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
30663731353038306664656333313032613039636134333435383762613735666562653432323363
|
||||
6637363832633337623436396163333237613534373033340a623362313361313565636332343363
|
||||
63343838656334373730303139616466323061383338343939313662356466646465333363666662
|
||||
3233376264313864300a323830666635323838643530393436393736323336343138383332323365
|
||||
38623962633165316262633963323461376530393133646532376561396130313565646663633766
|
||||
65373538393233373633393031323137323462343938323262636439663133323237303335616563
|
||||
64656262353931393635396361343131356632623836393835616462653439353734366461323432
|
||||
35373562306261666330663162613731363263623034623463646662346335366239306366626239
|
||||
3030
|
||||
64393466643139323164303532333865626432353430346466643432613664363962666137373861
|
||||
3138323435393937373239386136626436346462383965630a376366316130376631633339636531
|
||||
39643138323166313131313533643662363731316532633664326634373434356338343533653866
|
||||
6234346535343362390a393666626362313763346362663837376664663762656339393430353132
|
||||
64313164323630363637353230643834303164333665376437623235613264363965623530666236
|
||||
61643430333861376334373061643239386566316561373531333862626163386261643636313531
|
||||
39616637306466636462323337393239653135633962623965346134623262613236366438336264
|
||||
38326265666363643166363565636534633061643165646239663565363434323561633235353663
|
||||
65306636333664666361396638613634353166313430646462623633306239376331303066656536
|
||||
65623939306564613037613263343537623933653761303139323033633066393665393236366635
|
||||
36316462643231363832303233316461643330346435326263666337363435333833656632656231
|
||||
39636638313336613135653830396262366330636266653333336433316637626634306236393033
|
||||
65313061303066643566306133663830633136366633303665633332613432616237373161613338
|
||||
65643266336330393936663461386464386262323638343365313136326137373661363161633730
|
||||
30323630363038636462653737386232343562376433646435663335376562346466313863656330
|
||||
34363731636163396465653830303263393937633332333937633434343732343234386536653832
|
||||
31663535333732363736656138663163333861376365333632656266626161616166373537623166
|
||||
35626161383336333835336364653135356437353535373765383337326261303037373964356330
|
||||
33346264343736663866363639363766373435363137326638366636613464636637666432333331
|
||||
33383238323537656565393066373034346664396339366564343261643765343865353361393961
|
||||
34633538653333343234366332613739383738306462366139666537343965613465623236333733
|
||||
34656239393537656532383061383861623235323664663837356137333736316132383334363138
|
||||
37643363333636303935373461653436333436323439323662373731383536383662353637383664
|
||||
32366363333437323161
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
35653335616165373438616234383438383565613135623434393636363565616238386263613262
|
||||
3434613830633935646437313762383037613530643865310a616638343938613139666633613263
|
||||
62363437643666663864646432666533613634323036316263616239636437613631393364326430
|
||||
6434333865306339660a626534343037623266393231643566303932316362636332633461656436
|
||||
65663866626264623164306230363361623835343261323462613134346561663534383036613765
|
||||
30306637653966323631383461313031303461353331323133663430636131323635306137623161
|
||||
30666336636438393639346339643637616135356466303330303864303538633537636139396334
|
||||
37333632626239353931303238376362636437386137326630373032363730383965366631326665
|
||||
65663433323062333036313766363235316637326438663230353831366430333865313364663262
|
||||
61383436323464353832306631616533663262353233373139366335306462613162313463393863
|
||||
30613963656232646166363136626536623562666262646634653235393534666163363631616131
|
||||
36366538396364666339313639333530383961653566636439663931363235323138356335646664
|
||||
3866
|
||||
36313638653730326166623335303432306438393735343536346437373362633633663436663035
|
||||
6532333539373165353431376437396430386662326633380a306330623139383134346562343835
|
||||
32333962326266626637343537626665613865633239373633623532303434646163323238343266
|
||||
3130643837393739660a333238393933653561616161653036663663316464643331373433643961
|
||||
66306633353435643162346632336266666334303236333565313830343332616565353561386435
|
||||
66326135633535613233313265393135343135656165363566626562626564623966353866373839
|
||||
36653838323061656431396264363830653630366137353432653039376365663165346537353039
|
||||
39616366306564633339396631613932323934663934333534623731376430336330323038313061
|
||||
33636533356263346166363338333162663632363434383466623732383739643734383236663164
|
||||
38376637626131643861613332363663323037646636653463313365303638383337306232623263
|
||||
39643837376265613031326237623530653234616666396639623964613136613237306630313364
|
||||
32333037663236363761323136643431383438363533616634623134336635633566393231633534
|
||||
3633
|
||||
|
||||
Loading…
Reference in New Issue
Block a user