Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion roles/apt-dater-host/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
apt_dater_host:
home: "/var/lib/apt-dater"
username: "apt-dater"
home: "/var/lib/apt-dater"
forbid_install: false
forbid_upgrade: false
22 changes: 16 additions & 6 deletions roles/apt-dater-host/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- apt-dater

- name: apt-dater user
user: system=true createhome=yes home="{{ apt_dater_host_vars.home }}" name="{{ apt_dater_host_vars.username }}" state=present shell=/bin/sh comment="Apt-dater user,,,"
user: system=true createhome=yes home="{{ apt_dater_host.home }}" name="{{ apt_dater_host.username }}" state=present shell=/bin/sh comment="Apt-dater user,,,"
tags:
- apt-dater

Expand All @@ -19,12 +19,12 @@
- apt-dater

- name: ensure .ssh dir
file: state=directory path="{{ apt_dater_host_vars.home }}/.ssh/" owner="{{ apt_dater_host_vars.username }}" group=apt-dater mode=0700
file: state=directory path="{{ apt_dater_host.home }}/.ssh/" owner="{{ apt_dater_host.username }}" group=apt-dater mode=0700
tags:
- apt-dater

- name: install ssh-key
authorized_key: key="{{ apt_dater_host_vars.ssh_key }}" user="{{ apt_dater_host_vars.username }}" state=present
authorized_key: key="{{ apt_dater_host.ssh_key }}" user="{{ apt_dater_host.username }}" state=present
tags:
- apt-dater

Expand All @@ -33,13 +33,23 @@
when: "'cluster' in apt_dater_host"
tags:
- apt-dater
- apt-dater-conf

- name: remove Cluster
lineinfile: dest=/etc/apt-dater-host.conf regexp="@CLUSTERS.*" line="#@CLUSTERS = qw();" state=present
when: "'cluster' not in apt_dater_host"
tags:
- apt-dater
- apt-dater-conf

- name: config $FORBID_INSTALL
lineinfile: dest=/etc/apt-dater-host.conf regexp="\$FORBID_INSTALL.*" line="$FORBID_INSTALL={% if apt_dater_host_vars.forbid_install %}1{% else %}0{% endif %};" state=present
lineinfile: dest=/etc/apt-dater-host.conf regexp="\$FORBID_INSTALL.*" line="$FORBID_INSTALL={% if apt_dater_host.forbid_install == true %}1{% else %}0{% endif %};" state=present
tags:
- apt-dater
- apt-dater-conf

- name: config $FORBID_UPGRADE
lineinfile: dest=/etc/apt-dater-host.conf regexp="\$FORBID_UPGRADE.*" line="$FORBID_UPGRADE={% if apt_dater_host_vars.forbid_upgrade %}1{% else %}0{% endif %};" state=present
lineinfile: dest=/etc/apt-dater-host.conf regexp="\$FORBID_UPGRADE.*" line="$FORBID_UPGRADE={% if apt_dater_host.forbid_upgrade == true %}1{% else %}0{% endif %};" state=present
tags:
- apt-dater
- apt-dater
- apt-dater-conf
6 changes: 0 additions & 6 deletions roles/apt-dater-host/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
---
apt_dater_host_vars:
username: "{% if apt_dater_host is defined %}{% if 'username' in apt_dater_host %}{{ apt_dater_host.username }}{% else %}apt-dater{% endif %}{% else %}apt-dater{% endif %}"
home: "{% if 'home' in apt_dater_host %}{{ apt_dater_host.home }}{% else %}/var/lib/apt-dater{% endif %}"
ssh_key: "{% if 'ssh_key' in apt_dater_host %}{{ apt_dater_host.ssh_key }}{% endif %}"
forbid_install: "{% if 'forbid_install' in apt_dater_host %}{{ apt_dater_host.forbid_install }}{% else %}false{% endif %}"
forbid_upgrade: "{% if 'forbid_install' in apt_dater_host %}{{ apt_dater_host.forbid_upgrade }}{% else %}false{% endif %}"