|
|
@ -8,45 +8,39 @@ |
|
|
|
tags: bootstrap |
|
|
|
raw: python -c "import apt" || DEBIAN_FRONTEND=noninteractive apt-get --force-yes -y install python-apt |
|
|
|
when: ansible_distribution == 'Debian' |
|
|
|
|
|
|
|
# Check mandatory variables |
|
|
|
|
|
|
|
- name: Check vars |
|
|
|
# Check mandatory variables |
|
|
|
- name: Check vars |
|
|
|
fail: msg="Missing variable admin_ssh_keys" |
|
|
|
when: admin_ssh_keys is not defined |
|
|
|
|
|
|
|
- name: Check vars |
|
|
|
- name: Check vars |
|
|
|
fail: msg="Missing variable default_packages_debian" |
|
|
|
when: default_packages_debian is not defined |
|
|
|
|
|
|
|
- name: Check vars |
|
|
|
- name: Check vars |
|
|
|
fail: msg="Missing variable description" |
|
|
|
when: description is not defined |
|
|
|
|
|
|
|
- name: Check vars |
|
|
|
fail: msg="Missing variable ntp_server1" |
|
|
|
when: ntp_server1 is not defined |
|
|
|
|
|
|
|
- name: Check vars |
|
|
|
fail: msg="Missing variable ntp_server2" |
|
|
|
when: ntp_server2 is not defined |
|
|
|
- name: Check vars |
|
|
|
fail: msg="Missing variable ntp_servers" |
|
|
|
when: ntp_servers is not defined |
|
|
|
|
|
|
|
- name: Check vars |
|
|
|
- name: Check vars |
|
|
|
fail: msg="Missing variable disable_ipv6" |
|
|
|
when: disable_ipv6 is not defined |
|
|
|
|
|
|
|
# SSH |
|
|
|
|
|
|
|
- name: Deploy SSH keys |
|
|
|
tags: ssh_keys |
|
|
|
authorized_key: user=root key="{{item}}" |
|
|
|
with_items: "{{admin_ssh_keys}}" |
|
|
|
with_items: admin_ssh_keys |
|
|
|
|
|
|
|
# Packages |
|
|
|
|
|
|
|
- name: Install default packages Debian. |
|
|
|
apt: pkg={{item}} state=installed |
|
|
|
with_items: "{{ default_packages_debian }}" |
|
|
|
with_items: default_packages_debian |
|
|
|
when: ansible_distribution == 'Debian' |
|
|
|
|
|
|
|
# Configure NTP |
|
|
@ -57,21 +51,18 @@ |
|
|
|
|
|
|
|
# Basic Shell & vim configuration |
|
|
|
|
|
|
|
- name: Custom .bashrc |
|
|
|
tags: custom |
|
|
|
copy: src=root-.bashrc dest=/root/.bashrc |
|
|
|
- name: Custom .vimrc |
|
|
|
tags: custom |
|
|
|
copy: src=root-.vimrc dest=/root/.vimrc |
|
|
|
- name: Custom .inputrc |
|
|
|
tags: custom |
|
|
|
copy: src=root-.inputrc dest=/root/.inputrc |
|
|
|
- name: Create .vim/colors |
|
|
|
tags: custom |
|
|
|
file: path=/root/.vim/colors state=directory |
|
|
|
- name: Wombat vim colors theme is awesome |
|
|
|
|
|
|
|
- name: Custom .bashrc, .vimrc, .inputrc and Wombat vim colors theme |
|
|
|
tags: custom |
|
|
|
copy: src=root-.vim-colors-wombat.vim dest=/root/.vim/colors/wombat.vim |
|
|
|
copy: src={{ item.src }} dest={{ item.dest }} |
|
|
|
with_items: |
|
|
|
- { src: 'root-.bashrc', dest: '/root/.bashrc' } |
|
|
|
- { src: 'root-.vimrc', dest: '/root/.vimrc' } |
|
|
|
- { src: 'root-.inputrc', dest: '/root/.inputrc' } |
|
|
|
- { src: 'root-.vim-colors-wombat.vim', dest: '/root/.vim/colors/wombat.vim' } |
|
|
|
|
|
|
|
# Set motd and README.root |
|
|
|
|
|
|
@ -79,13 +70,12 @@ |
|
|
|
tags: custom |
|
|
|
template: src=etc-motd.j2 dest=/etc/motd |
|
|
|
|
|
|
|
- name: Modify /root/.profile |
|
|
|
- name: Modify /root/.profile, Add basic README.root |
|
|
|
tags: custom |
|
|
|
copy: src=root-.profile dest=/root/.profile |
|
|
|
when: initialize == 'True' |
|
|
|
- name: Add basic README.root |
|
|
|
tags: custom |
|
|
|
copy: src=root-README.root dest=/root/README.root |
|
|
|
copy: src={{ item.src }} dest={{ item.dest }} |
|
|
|
with_items: |
|
|
|
- { src: 'root-.profile', dest: '/root/.profile' } |
|
|
|
- { src: 'root-README.root', dest: '/root/README.root' } |
|
|
|
when: initialize == 'True' |
|
|
|
|
|
|
|
# Env setup |
|
|
@ -97,11 +87,11 @@ |
|
|
|
debconf: name=locales question='locales/locales_to_be_generated' value='fr_FR.UTF-8, UTF-8' vtype='multiselect' |
|
|
|
when: ansible_distribution == 'Debian' |
|
|
|
|
|
|
|
- name: Set the timezone |
|
|
|
tags: environ |
|
|
|
debconf: name=tzdata question='tzdata/Zones/Etc' value='UTC' vtype='select' |
|
|
|
debconf: name=tzdata question='tzdata/Areas' value='Europe' vtype='select' |
|
|
|
debconf: name=tzdata question='tzdata/Zones/Europe' value='Paris' vtype='select' |
|
|
|
- name: Set timezone |
|
|
|
copy: content='{{ tzdata_timezone | default('Europe/Paris') }}' |
|
|
|
dest=/etc/timezone owner=root group=root mode=0644 |
|
|
|
notify: |
|
|
|
- update timezone |
|
|
|
when: ansible_distribution == 'Debian' |
|
|
|
|
|
|
|
- name: Disable IPv6 (need reboot) |
|
|
|