Skip to content

Commit

Permalink
Split big lines in tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
HanXHX committed Aug 24, 2015
1 parent 1f68336 commit eb790e6
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 12 deletions.
12 changes: 9 additions & 3 deletions tasks/apt.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---

- name: COPY | Configure APT no extra packages
copy: src=etc/apt/apt.conf.d/90noextrapackages dest=/etc/apt/apt.conf.d/90noextrapackages
copy: >
src=etc/apt/apt.conf.d/90noextrapackages
dest=/etc/apt/apt.conf.d/90noextrapackages
# We MUST update cache... Ansible auto install python-apt
- name: APT | Update
Expand All @@ -11,14 +13,18 @@
file: path=/etc/apt/sources.list state=absent

- name: APT | Add repositories
apt_repository: repo="deb http://{{ dbs_apt_default_host }}/debian {{ item }} {{ dbs_apt_components }}" state=present
apt_repository: >
repo="deb http://{{ dbs_apt_default_host }}/debian {{ item }} {{ dbs_apt_components }}"
state=present
with_items:
- "{{ ansible_distribution_release }}"
- "{{ ansible_distribution_release }}-updates"
- "{{ ansible_distribution_release }}-backports"

- name: APT | Add src repositories
apt_repository: repo="deb-src http://{{ dbs_apt_default_host }}/debian {{ item }} {{ dbs_apt_components }}" state="{{ 'present' if dbs_apt_use_src else 'absent' }}"
apt_repository: >
repo="deb-src http://{{ dbs_apt_default_host }}/debian {{ item }} {{ dbs_apt_components }}"
state="{{ 'present' if dbs_apt_use_src else 'absent' }}"
with_items:
- "{{ ansible_distribution_release }}"
- "{{ ansible_distribution_release }}-updates"
Expand Down
10 changes: 8 additions & 2 deletions tasks/hostname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@
# when: change_hostname.changed

- name: REPLACE | Change old fqdn dbs_hostname to new on several files
replace: dest={{ item }} regexp='\b{{ ansible_fqdn }}\b' replace='{{ dbs_hostname }}'
replace: >
dest={{ item }}
regexp='\b{{ ansible_fqdn }}\b'
replace='{{ dbs_hostname }}'
with_items: dbs_hostname_files
ignore_errors: yes
when: change_hostname.changed

- name: REPLACE | Change old short dbs_hostname to new on several files
replace: dest={{ item }} regexp='\b{{ ansible_hostname }}\b' replace='{{ dbs_hostname | regex_replace('^(\w)\..+$', '\\1') }}'
replace: >
dest={{ item }}
regexp='\b{{ ansible_hostname }}\b'
replace='{{ dbs_hostname | regex_replace('^(\w)\..+$', '\\1') }}'
with_items: dbs_hostname_files
ignore_errors: yes
when: change_hostname.changed
Expand Down
5 changes: 4 additions & 1 deletion tasks/locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
template: src=etc/default/locale.j2 dest=/etc/default/locale

- name: LINEINFILE | Uncomment necessary lines in /etc/locale.gen
lineinfile: dest=/etc/locale.gen regexp="^# ({{ item }}) (.*)$" line="{{ item }} \1" backrefs=yes
lineinfile: >
dest=/etc/locale.gen
regexp="^# ({{ item }}) (.*)$" line="{{ item }} \1"
backrefs=yes
with_items: system_locales
notify: locale-gen
6 changes: 5 additions & 1 deletion tasks/system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
when: dbs_use_dotfiles

- name: SYSCTL | Tuning
sysctl: name={{ item.key }} value='{{ item.value }}' sysctl_file=/etc/sysctl.d/ansible.conf state=present
sysctl: >
name={{ item.key }}
value='{{ item.value }}'
sysctl_file=/etc/sysctl.d/ansible.conf
state=present
with_items: dbs_sysctl_config

14 changes: 12 additions & 2 deletions tasks/timezone.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
---

- name: COPY | Set /etc/localtime to {{ dbs_timezone }}
copy: src=/usr/share/zoneinfo/{{ dbs_timezone }} dest=/etc/localtime owner=root group=root mode=0644
copy: >
src=/usr/share/zoneinfo/{{ dbs_timezone }}
dest=/etc/localtime
owner=root
group=root
mode=0644
notify: [ update tzdata, restart cron ]

- name: COPY | Set default timezone
copy: content="{{ dbs_timezone }}\n" dest=/etc/timezone owner=root group=root mode=0644
copy: >
content="{{ dbs_timezone }}\n"
dest=/etc/timezone
owner=root
group=root
mode=0644
notify: [ update tzdata, restart cron ]
9 changes: 7 additions & 2 deletions tasks/unbound.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
apt: pkg=unbound state=present

- name: REPLACE | Apply dns configuration to /etc/network/interfaces if necessary
replace: dest=/etc/network/interfaces regexp='^\s+dns-nameservers' replace='\tdns-nameservers 127.0.0.1'
replace: >
dest=/etc/network/interfaces
regexp='^\s+dns-nameservers'
replace='\tdns-nameservers 127.0.0.1'
notify: reload networking

- name: STAT | Check if DHCP client config
stat: path=/etc/dhcp/dhclient.conf
register: dhcp

- name: LINEINFILE | Prepend DNS config on DHCP
lineinfile: dest=/etc/dhcp/dhclient.conf line='prepend domain-name-servers 127.0.0.1;'
lineinfile: >
dest=/etc/dhcp/dhclient.conf
line='prepend domain-name-servers 127.0.0.1;'
when: dhcp.stat.exists
notify: reload networking
5 changes: 4 additions & 1 deletion tasks/user.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---

- name: USER | Add system users
user: name={{ item.name }} shell={{ item.shell | default('/bin/bash') }} comment={{ item.comment | default('') }}
user: >
name={{ item.name }}
shell={{ item.shell | default('/bin/bash') }}
comment={{ item.comment | default('') }}
with_items: dbs_users

- name: AUTHORIZED_KEY | Install SSH public key to system users
Expand Down

0 comments on commit eb790e6

Please sign in to comment.