Commit f6ced63f authored by ulif's avatar ulif 🐻

Add role to prepare hosts.

Includes setting up hostname, fix /etc/hosts entries and the like.
parent 1efa4f4a
# Prepare BBB installation
- set_fact: bbbfqdn="{{ inventory_hostname }}"
- set_fact: domainname="{{ inventory_hostname.split('.')[1:] | join('.') }}"
- set_fact: hostname="{{ inventory_hostname.split('.')[0] }}"
- name: Using hostname determined from inventory
debug: var=hostname
- name: Using domainname determined from inventory
debug: var=domainname
- name: Using fqdn determined from inventory
debug: var=bbbfqdn
- name: Fix hosts file for FQDN
lineinfile:
state=present
dest=/etc/hosts
line="{{ ansible_default_ipv4.address }} {{ bbbfqdn }} {{ hostname }}"
regexp="^{{ ansible_default_ipv4.address }}"
- name: Remove entry for 127.0.1.1 in /etc/hosts
lineinfile:
state=absent
dest=/etc/hosts
regexp='^127\.0\.1\.1'
- name: Change the hostname
hostname:
name="{{ hostname }}"
$ANSIBLE_VAULT;1.1;AES256
37313165663965663233336535306638333763323466386463663963663739653866333331663739
3361653964363538393434663034316164663732346536630a346235343165373339333037646163
65666639353862373562643566656233633561653432666630623966363534393539313033376337
3761633237663865310a346132396531313965613261343438373032303465613665326639336663
66356164383937336666303038356333333562386563323637616537386331353561323962333431
33303137393032343861336531396332626431393131396633363239666665613431623437313533
32303935323539336465333161643663666363373765633266383961653531653664613030616439
35333337333535633064393336626637383533383939663538356565323430363231653339373035
38626137333836643135373833613262393535363566346262326633383963623537303139633832
33303931313132313131383066316535323232656663646236323166643039633265653339383232
37653337313339353337363366343235336233663632306232366639663766623362623238336138
38613332323836376466373833396630633635316531353032373835633564346230616662356566
36353035323339653762363039383237333663373939356134356566613538316261343463633764
30613130386230663766643232393235323635353334633439613534363164313733353231653934
38653261643730616535643465623836643061363531363238306437356332303935613065313533
32383366623831623937643638343430643133373438393763666662663631303036383335633265
65326662643133373037663135313430363864666336643835616461353539653464393139643439
6361323636663231663835363563306538313664323736396435
37373338313738623737616136666435376138303831646464393861383165373430633361383166
3461396664383564646232643833346335396163613732380a356563366465386662316331646463
30353061653439303238303235666561386538373033313835326262613137346666626465646264
3463336536353131330a623062353238643037303337613030646336613437633636356639323461
33313330396331643661613966376235306166383737336533613838356536363766303532626163
61343132363230666665383239643337383036326533643164666166663862383233313734623537
35646261643161313039613734303931643430353561356133626432383436623438613366643532
66333566356539303635653133366261343064306535343333353537653332656164643866313435
34363635396138383035613865356530383766383735323533383432333361353835316330343033
37333339303130393263323661373531646463353362656334383031616139303236343335373365
35373433633764343534616538623737306237303731626633653430383331343562663363353238
39323030333035653635326530363736323663646433653065343864633433336438646536633230
65376134363531316438613366643863643839663561663061613936343965623265386333636531
62366461356536623935393433323631303261626432336565623162643630633831613433363961
31366266383332343165633937623236313139646236373839633030383536386231393964346562
63316232366234353965336234343931396438643336303463636162343661633039383030326232
63303834616533396362623130343136326365636532366537666639396536623632613465306234
66643633316239616131326637366162663939396131663435663832333663316362323132393835
31613036643537393066613464363732646664393130346336626263623131663763613235363539
32313965623061636238363331623938623861623730346131613036323561373533303035333163
34393462623963363739323065313831386237386433383030393033616435316237
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment