diff options
author | Matthieu Saulnier <fantom@fedoraproject.org> | 2017-06-14 23:18:31 +0200 |
---|---|---|
committer | Matthieu Saulnier <fantom@fedoraproject.org> | 2017-06-14 23:18:31 +0200 |
commit | 92c606c4e2ce34eb94f4b10c34d9fb94edfa7b7e (patch) | |
tree | 0b44edf857de15a94f6a7369c93fdc21fd315579 | |
parent | 32c89a8c9ce215ba1fdb595efb2992c154f8d9b6 (diff) | |
download | playbooks-ansible-92c606c4e2ce34eb94f4b10c34d9fb94edfa7b7e.tar.gz playbooks-ansible-92c606c4e2ce34eb94f4b10c34d9fb94edfa7b7e.tar.xz playbooks-ansible-92c606c4e2ce34eb94f4b10c34d9fb94edfa7b7e.zip |
use more variables in ntpserver role
-rw-r--r-- | host_vars/109.238.2.79 | 1 | ||||
-rw-r--r-- | host_vars/176.31.191.26 | 1 | ||||
-rw-r--r-- | host_vars/192.168.0.25 | 1 | ||||
-rw-r--r-- | host_vars/195.154.75.244 | 1 | ||||
-rw-r--r-- | host_vars/bpr7drsao5vozzr5.onion | 1 | ||||
-rw-r--r-- | host_vars/d72vewh3wa4lwpaj.onion | 1 | ||||
-rw-r--r-- | host_vars/gfuzfrkr6mg47ktw.onion | 1 | ||||
-rw-r--r-- | host_vars/lancaster.casperlefantom.net | 1 | ||||
-rw-r--r-- | host_vars/lancaster.home.casperlefantom.net | 1 | ||||
-rw-r--r-- | host_vars/ns2.casperlefantom.net | 1 | ||||
-rw-r--r-- | host_vars/ns3.casperlefantom.net | 1 | ||||
-rw-r--r-- | host_vars/ns4.casperlefantom.net | 1 | ||||
-rw-r--r-- | host_vars/qunkjql4sgxnb6vr.onion | 1 | ||||
-rw-r--r-- | roles/ntpserver/templates/chrony.conf.j2 | 23 | ||||
-rw-r--r-- | roles/ntpserver/templates/ntp.conf.j2 | 23 | ||||
-rw-r--r-- | roles/ntpserver/vars/main.yml | 13 |
16 files changed, 54 insertions, 18 deletions
diff --git a/host_vars/109.238.2.79 b/host_vars/109.238.2.79 index 42b84df..7a408b4 100644 --- a/host_vars/109.238.2.79 +++ b/host_vars/109.238.2.79 @@ -2,3 +2,4 @@ nickname: Casper02 is_gardian: true bprate: '100 MB' bpburst: '120 MB' +is_ntpslave: true diff --git a/host_vars/176.31.191.26 b/host_vars/176.31.191.26 index 3a2c2fe..c90d88a 100644 --- a/host_vars/176.31.191.26 +++ b/host_vars/176.31.191.26 @@ -2,4 +2,5 @@ nickname: Casper03 is_gardian: true bprate: '100 MB' bpburst: '120 MB' +is_ntpslave: true diff --git a/host_vars/192.168.0.25 b/host_vars/192.168.0.25 index 554bef8..addd52a 100644 --- a/host_vars/192.168.0.25 +++ b/host_vars/192.168.0.25 @@ -1,4 +1,5 @@ is_dnsmaster: true +is_ntpmaster: true nickname: Casper01 bprate: '80 KB' bpburst: '100 KB' diff --git a/host_vars/195.154.75.244 b/host_vars/195.154.75.244 index 8ae1d70..b6ecdc3 100644 --- a/host_vars/195.154.75.244 +++ b/host_vars/195.154.75.244 @@ -2,4 +2,5 @@ nickname: Casper04 bprate: '100 MB' bpburst: '120 MB' outdoor: true +is_ntpslave: true diff --git a/host_vars/bpr7drsao5vozzr5.onion b/host_vars/bpr7drsao5vozzr5.onion index 8ae1d70..b6ecdc3 100644 --- a/host_vars/bpr7drsao5vozzr5.onion +++ b/host_vars/bpr7drsao5vozzr5.onion @@ -2,4 +2,5 @@ nickname: Casper04 bprate: '100 MB' bpburst: '120 MB' outdoor: true +is_ntpslave: true diff --git a/host_vars/d72vewh3wa4lwpaj.onion b/host_vars/d72vewh3wa4lwpaj.onion index 554bef8..addd52a 100644 --- a/host_vars/d72vewh3wa4lwpaj.onion +++ b/host_vars/d72vewh3wa4lwpaj.onion @@ -1,4 +1,5 @@ is_dnsmaster: true +is_ntpmaster: true nickname: Casper01 bprate: '80 KB' bpburst: '100 KB' diff --git a/host_vars/gfuzfrkr6mg47ktw.onion b/host_vars/gfuzfrkr6mg47ktw.onion index 3a2c2fe..c90d88a 100644 --- a/host_vars/gfuzfrkr6mg47ktw.onion +++ b/host_vars/gfuzfrkr6mg47ktw.onion @@ -2,4 +2,5 @@ nickname: Casper03 is_gardian: true bprate: '100 MB' bpburst: '120 MB' +is_ntpslave: true diff --git a/host_vars/lancaster.casperlefantom.net b/host_vars/lancaster.casperlefantom.net index 554bef8..addd52a 100644 --- a/host_vars/lancaster.casperlefantom.net +++ b/host_vars/lancaster.casperlefantom.net @@ -1,4 +1,5 @@ is_dnsmaster: true +is_ntpmaster: true nickname: Casper01 bprate: '80 KB' bpburst: '100 KB' diff --git a/host_vars/lancaster.home.casperlefantom.net b/host_vars/lancaster.home.casperlefantom.net index 554bef8..addd52a 100644 --- a/host_vars/lancaster.home.casperlefantom.net +++ b/host_vars/lancaster.home.casperlefantom.net @@ -1,4 +1,5 @@ is_dnsmaster: true +is_ntpmaster: true nickname: Casper01 bprate: '80 KB' bpburst: '100 KB' diff --git a/host_vars/ns2.casperlefantom.net b/host_vars/ns2.casperlefantom.net index 42b84df..7a408b4 100644 --- a/host_vars/ns2.casperlefantom.net +++ b/host_vars/ns2.casperlefantom.net @@ -2,3 +2,4 @@ nickname: Casper02 is_gardian: true bprate: '100 MB' bpburst: '120 MB' +is_ntpslave: true diff --git a/host_vars/ns3.casperlefantom.net b/host_vars/ns3.casperlefantom.net index 3a2c2fe..c90d88a 100644 --- a/host_vars/ns3.casperlefantom.net +++ b/host_vars/ns3.casperlefantom.net @@ -2,4 +2,5 @@ nickname: Casper03 is_gardian: true bprate: '100 MB' bpburst: '120 MB' +is_ntpslave: true diff --git a/host_vars/ns4.casperlefantom.net b/host_vars/ns4.casperlefantom.net index 8ae1d70..b6ecdc3 100644 --- a/host_vars/ns4.casperlefantom.net +++ b/host_vars/ns4.casperlefantom.net @@ -2,4 +2,5 @@ nickname: Casper04 bprate: '100 MB' bpburst: '120 MB' outdoor: true +is_ntpslave: true diff --git a/host_vars/qunkjql4sgxnb6vr.onion b/host_vars/qunkjql4sgxnb6vr.onion index 42b84df..7a408b4 100644 --- a/host_vars/qunkjql4sgxnb6vr.onion +++ b/host_vars/qunkjql4sgxnb6vr.onion @@ -2,3 +2,4 @@ nickname: Casper02 is_gardian: true bprate: '100 MB' bpburst: '120 MB' +is_ntpslave: true diff --git a/roles/ntpserver/templates/chrony.conf.j2 b/roles/ntpserver/templates/chrony.conf.j2 index f6078c9..d8644bf 100644 --- a/roles/ntpserver/templates/chrony.conf.j2 +++ b/roles/ntpserver/templates/chrony.conf.j2 @@ -1,16 +1,21 @@ # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). -{% if ansible_hostname == "lancaster" %} -server 0.fedora.pool.ntp.org iburst -server 1.fedora.pool.ntp.org iburst -server 2.fedora.pool.ntp.org iburst -server 3.fedora.pool.ntp.org iburst +{% if is_ntpmaster is defined %} +{% for item in primarylist %} +server {{ item }} iburst +{% endfor %} {% endif %} -{% if ansible_hostname != "lancaster" %} -server ntp1.casperlefantom.net iburst + +{% if is_ntpmaster is not defined %} +{% for item in masterlist %} +server {{ item }} iburst +{% endfor %} + +{% if is_ntpslave is not defined %} +{% for item in slavelist %} +server {{ item }} iburst +{% endfor %} {% endif %} -{% if ansible_hostname != "vps128389" and ansible_hostname != "lancaster" %} -server ntp3.casperlefantom.net iburst {% endif %} # Ignore stratum in source selection. diff --git a/roles/ntpserver/templates/ntp.conf.j2 b/roles/ntpserver/templates/ntp.conf.j2 index 72b18b2..f5e3931 100644 --- a/roles/ntpserver/templates/ntp.conf.j2 +++ b/roles/ntpserver/templates/ntp.conf.j2 @@ -19,17 +19,22 @@ restrict -6 ::1 # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). -{% if ansible_hostname == "lancaster" %} -server 0.centos.pool.ntp.org iburst -server 1.centos.pool.ntp.org iburst -server 2.centos.pool.ntp.org iburst -server 3.centos.pool.ntp.org iburst +{% if is_ntpmaster is defined %} +{% for item in primarylist %} +server {{ item }} iburst +{% endfor %} {% endif %} -{% if ansible_hostname != "lancaster" %} -server ntp1.casperlefantom.net iburst + +{% if is_ntpmaster is not defined %} +{% for item in masterlist %} +server {{ item }} iburst +{% endfor %} + +{% if is_ntpslave is not defined %} +{% for item in slavelist %} +server {{ item }} iburst +{% endfor %} {% endif %} -{% if ansible_hostname != "vps128389" and ansible_hostname != "lancaster" %} -server ntp3.casperlefantom.net iburst {% endif %} #broadcast 192.168.1.255 autokey # broadcast server diff --git a/roles/ntpserver/vars/main.yml b/roles/ntpserver/vars/main.yml new file mode 100644 index 0000000..1fea13f --- /dev/null +++ b/roles/ntpserver/vars/main.yml @@ -0,0 +1,13 @@ +primarylist: + - 0.centos.pool.ntp.org + - 1.centos.pool.ntp.org + - 2.centos.pool.ntp.org + - 3.centos.pool.ntp.org + +masterlist: + - ntp1.casperlefantom.net + +slavelist: + - ntp2.casperlefantom.net + - ntp3.casperlefantom.net + - ntp4.casperlefantom.net |