diff --git a/playbook_crowdstrike.yml b/playbook_crowdstrike.yml
new file mode 100644
index 0000000..2d00f6c
--- /dev/null
+++ b/playbook_crowdstrike.yml
@@ -0,0 +1,15 @@
+---
+- import_playbook: playbook_ssh_known_host.yml
+- name: Configure CrwodStrike
+ hosts:
+ - all
+ gather_facts: yes
+ pre_tasks:
+ - name: Gather hardware facts
+ setup:
+ gather_subset:
+ - hardware
+ roles:
+ - {role: iptables, when: ansible_facts.os_family == "RedHat", tags: ["iptables"], become: true, become_method: sudo}
+ - {role: crowdstrike, tags: ["crowdstrike"], become: true, become_method: sudo}
+...
diff --git a/playbook_disk.yml b/playbook_disk.yml
new file mode 100644
index 0000000..3c14402
--- /dev/null
+++ b/playbook_disk.yml
@@ -0,0 +1,8 @@
+---
+- name: Manage disk
+ hosts:
+ - jumpboxes
+ gather_facts: no
+ roles:
+ - {role: azure_disk, tags: ["azure", "disk"]}
+...
diff --git a/playbook_dynatrace.yml b/playbook_dynatrace.yml
new file mode 100644
index 0000000..4dc45a0
--- /dev/null
+++ b/playbook_dynatrace.yml
@@ -0,0 +1,112 @@
+---
+- import_playbook: playbook_ssh_known_host.yml
+- name: Configure Dynatrace
+ hosts:
+ - all
+ gather_facts: yes
+ vars_files:
+ - vars/dynatrace.yml
+ pre_tasks:
+ - name: Gather hardware facts
+ setup:
+ gather_subset:
+ - hardware
+ roles:
+ - {role: mkfs, tags: ["mkfs"], become: true, become_method: sudo}
+ - {role: mount, tags: ["mount"], become: true, become_method: sudo}
+ - {role: iptables, when: ansible_facts.os_family == "RedHat", tags: ["iptables"], become: true, become_method: sudo}
+ tasks:
+ - name: ipatbles show
+ command: iptables -S
+ become: true
+ become_method: sudo
+ failed_when: false
+
+ - name: Ensure SELinux is set to enforcing mode
+ lineinfile:
+ path: /etc/selinux/config
+ regexp: '^SELINUX='
+ line: SELINUX=disabled
+ when: ansible_facts.os_family == "RedHat"
+ become: true
+ become_method: sudo
+
+ - name: selinux show
+ command: sestatus
+ when: ansible_facts.os_family == "RedHat"
+ become: true
+ become_method: sudo
+ failed_when: false
+
+ - name: Check if authorized_keys exists
+ stat:
+ path: "{{ ansible_user_keys }}"
+ register: stat_result
+
+ - name: Add Dynatrace teams keys
+ lineinfile:
+ path: "{{ ansible_user_keys }}"
+ line: "{{ dynatrace_admin_key }}"
+ when: stat_result.stat.exists
+ become: true
+ become_method: sudo
+ failed_when: false
+
+ - name: Download installer
+ get_url:
+ url: "{{ dynatrace_url }}" #https://dynatrace.desjardins.com/e/0a8b018a-cb27-43e7-b545-4ea4b71af8c7/api/v1/deployment/installer/gateway/unix/lates
+ dest: "{{ download_dir | default('/tmp', true)}}/{{ download_file | default('Dynatrace-ActiveGate-Linux.sh', true) }}"
+ checksum: "{{ checksum | default('', true) }}"
+ force: "{{ force | default(false, true) }}"
+ headers: "{{ dynatrace_headers | default({'accept': 'application/octet-stream', 'Authorization': dynatrace_token}, true) }}"
+ mode: "{{ mode | default(0540, true) }}"
+ validate_certs: "{{ validate_tls | default(false, true) }}"
+ delegate_to: localhost
+
+ - name: Check if uninstall exist
+ stat:
+ path: "{{ dynatrace_bin_dir }}/uninstall.sh"
+ register: unins
+ become: true
+ become_method: sudo
+
+ - name: Check if Dynatrace binary dir exist
+ stat:
+ path: "{{ dynatrace_bin_dir }}"
+ register: dyna_bindir
+ become: true
+ become_method: sudo
+
+ - name: Check if Dynatrace log dir exist
+ stat:
+ path: "{{ dynatrace_log_dir }}"
+ register: dyna_logdir
+ become: true
+ become_method: sudo
+
+ - name: Uninstall if bin dir exist and not log dir
+ block:
+ - name: Uninstall
+ command: "{{ dynatrace_bin_dir }}/uninstall.sh"
+ when:
+ - unins.stat.exists
+ - name: Delete install dir
+ file:
+ path: "{{ dynatrace_install_dir }}"
+ state: absent
+ - name: Remove data dir content
+ shell: "rm -rf /dynatrace/*"
+ failed_when: false
+ when:
+ - dyna_bindir.stat.exists
+ - not dyna_logdir.stat.exists
+ become: true
+ become_method: sudo
+
+ - name: Run installer
+ script: "{{ download_dir | default('/tmp', true)}}/{{ download_file | default('Dynatrace-ActiveGate-Linux.sh', true) }} {{ dynatrace_installation_options | default('', true) }}"
+ when:
+ - not dyna_bindir.stat.exists or not dyna_logdir.stat.exists
+ become: true
+ become_method: sudo
+...
diff --git a/playbook_jumpbox.yml b/playbook_jumpbox.yml
new file mode 100644
index 0000000..2a3cf8f
--- /dev/null
+++ b/playbook_jumpbox.yml
@@ -0,0 +1,96 @@
+---
+- import_playbook: playbook_ssh_known_host.yml
+- name: Configure jumpbox
+ hosts:
+ - all
+ gather_facts: yes
+ vars_files:
+ - vars/jumpbox.yml
+ tasks:
+ - name: Install useful packages
+ package:
+ name: "{{ packages }}"
+ state: present
+ become: true
+ become_method: sudo
+
+ - name: Install pip useful packages
+ pip:
+ name: "{{ pip_packages }}"
+ executable: "{{ pip_exe | default(omit, true) }}"
+ state: present
+ extra_args: "{{ pip_args }}"
+
+ - name: Update ssh config
+ block:
+ - name: Modify sshd config
+ lineinfile:
+ path: /etc/ssh/sshd_config
+ regexp: '^MaxStartups.*'
+ line: MaxStartups 100:30:100
+
+ - name: Modify ssh config
+ lineinfile:
+ path: /etc/ssh/ssh_config
+ regexp: '^ServerAliveInterval.*'
+ line: ServerAliveInterval 60
+
+ - name: Restart service ssh
+ service:
+ name: sshd
+ state: restarted
+ become: true
+ become_method: sudo
+
+ - name: Determine existing users
+ shell: 'cut -d: -f1 /etc/passwd | grep d*-local'
+ register: existing_users
+ failed_when: false
+
+ - name: Create username list
+ set_fact:
+ new_usernames: "{{ new_usernames | default([]) }} + ['{{item.username}}']"
+ loop: "{{ users }}"
+
+ - name: Update users
+ block:
+ - name: Delete removed users
+ user:
+ name: "{{ item }}"
+ remove: true
+ force: true
+ state: absent
+ loop: "{{ existing_users.stdout_lines | default([]) }}"
+ when: item not in new_usernames
+
+ - name: Create local user accounts
+ user:
+ name: "{{ item.username }}"
+ password: "{{ item.passwd | password_hash('sha512') }}"
+ loop: "{{ users }}"
+
+ - name: Add authorized keys
+ authorized_key:
+ user: "{{ item.username }}"
+ key: "{{ item.pubkey }}"
+ loop: "{{ users }}"
+
+ - name: Ensure sudoers.d exist
+ file:
+ path: "/etc/sudoers.d/"
+ state: directory
+ owner: root
+ group: root
+
+ - name: Create user sudoers files
+ template:
+ src: sudoers.j2
+ dest: "/etc/sudoers.d/99-users"
+ owner: root
+ group: root
+ mode: '0640'
+
+ become: true
+ become_method: sudo
+ no_log: True
+...
diff --git a/playbook_ntp.yml b/playbook_ntp.yml
new file mode 100644
index 0000000..e04463e
--- /dev/null
+++ b/playbook_ntp.yml
@@ -0,0 +1,30 @@
+---
+- import_playbook: playbook_ssh_known_host.yml
+- name: Configure NTP server
+ hosts:
+ - all
+ gather_facts: yes
+ vars_files:
+ - vars/ntp.yml
+ pre_tasks:
+ - apt:
+ name: '*'
+ update_cache: true
+ only_upgrade: true
+ state: latest
+ when: ansible_facts.os_family == "Debian"
+ become: true
+ become_method: sudo
+ - yum:
+ name: '*'
+ update_cache: true
+ security: true
+ state: latest
+ update_only: true
+ when: ansible_facts.os_family == "RedHat"
+ become: true
+ become_method: sudo
+ roles:
+ - {role: ntp_server, tags: ["ntp"], become: true, become_method: sudo}
+ - {role: iptables, become: true, become_method: sudo}
+...
diff --git a/playbook_powerdns.yml b/playbook_powerdns.yml
new file mode 100644
index 0000000..38cf2b2
--- /dev/null
+++ b/playbook_powerdns.yml
@@ -0,0 +1,41 @@
+---
+- import_playbook: playbook_ssh_known_host.yml
+- name: Configure PowerDNS auth server
+ hosts:
+ - all
+ gather_facts: yes
+ vars_files:
+ - vars/powerdns.yml
+ pre_tasks:
+ - apt:
+ name: '*'
+ update_cache: true
+ only_upgrade: true
+ state: latest
+ when: ansible_facts.os_family == "Debian"
+ become: true
+ become_method: sudo
+ - yum:
+ name: '*'
+ update_cache: true
+ security: true
+ state: latest
+ update_only: true
+ when: ansible_facts.os_family == "RedHat"
+ become: true
+ become_method: sudo
+ - set_fact:
+ managed_domains: "{{ query('fileglob', '*.zone') | map('regex_replace', '(.*/)(.*).zone$', '\\2') | list | default([], true) }}"
+ - set_fact:
+ auth_ip_addresses: "{{ (slave_ip_addresses | default([], true)) | union(master_ip_addresses | default([], true)) | default(['127.0.0.0/8'], true) }}"
+ - set_fact:
+ delegated_managed_domains: "{{ delegated_managed_domains | default({}, true) | combine({item:auth_ip_addresses}) }}"
+ loop: "{{ managed_domains | default([], true) }}"
+ - set_fact:
+ pdns_rec_forward_zones: "{{ (pdns_rec_forward_zones | default([])) + [[item.key, ((item.value | map('regex_replace', '/.*$')) | join(';'))] | join('=')] }}"
+ loop: "{{ lookup('dict', (delegated_domains | default({}, true) | combine(delegated_managed_domains | default({}, true))), wantlist=true) }}"
+ roles:
+ - {role: powerdns.pdns, tags: ["auth"], become: true, become_method: sudo}
+ - {role: powerdns.pdns_recursor, tags: ["recursor"], become: true, become_method: sudo}
+ - {role: iptables, become: true, become_method: sudo}
+...
diff --git a/playbook_rapid7.yml b/playbook_rapid7.yml
new file mode 100644
index 0000000..dde88ad
--- /dev/null
+++ b/playbook_rapid7.yml
@@ -0,0 +1,16 @@
+---
+- import_playbook: playbook_ssh_known_host.yml
+- name: Configure Rapid7
+ hosts:
+ - all
+ gather_facts: yes
+ pre_tasks:
+ - name: Gather hardware facts
+ setup:
+ gather_subset:
+ - hardware
+ roles:
+ - {role: iptables, when: ansible_facts.os_family == "RedHat", tags: ["iptables"], become: true, become_method: sudo}
+ - {role: rapid7, when: ansible_facts.os_family == "RedHat", tags : ["rapid7"], become: true, become_method: sudo}
+
+...
diff --git a/playbook_ssh_known_host.yml b/playbook_ssh_known_host.yml
new file mode 100644
index 0000000..eeba977
--- /dev/null
+++ b/playbook_ssh_known_host.yml
@@ -0,0 +1,10 @@
+---
+- name: Update ssh known host
+ hosts:
+ - all,!localhost
+ tags:
+ - "ssh"
+ gather_facts: no
+ roles:
+ - {role: known_hosts, tags: ["ssh"]}
+...
diff --git a/roles/crowdstrike/LICENSE b/roles/crowdstrike/LICENSE
new file mode 100644
index 0000000..3877ae0
--- /dev/null
+++ b/roles/crowdstrike/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/roles/crowdstrike/README.md b/roles/crowdstrike/README.md
new file mode 100644
index 0000000..99eadb1
--- /dev/null
+++ b/roles/crowdstrike/README.md
@@ -0,0 +1,2 @@
+# Agent CrowdStrike
+A role to install security agent crowdstrike
diff --git a/roles/crowdstrike/defaults/main.yml b/roles/crowdstrike/defaults/main.yml
new file mode 100644
index 0000000..36b11b3
--- /dev/null
+++ b/roles/crowdstrike/defaults/main.yml
@@ -0,0 +1,6 @@
+---
+Crowdstrike_version_win: WindowsSensor_CEAF4C36516B4D5EA9E28204357AE180-79.exe
+Crowdstrike_cid: CEAF4C36516B4D5EA9E28204357AE180-79
+Crowdstrike_version_rh: falcon-sensor-5.25.0-8902.el7.x86_64.rpm #falcon-sensor-5.31.0-9606.el6.x86_64.rpm falcon-sensor-5.31.0-9606.el8.x86_64.rpm
+Crowdstrike_version_deb: falcon-sensor_5.25.0-8902_amd64.deb
+...
diff --git a/roles/crowdstrike/files/README.md b/roles/crowdstrike/files/README.md
new file mode 100644
index 0000000..b90e88d
--- /dev/null
+++ b/roles/crowdstrike/files/README.md
@@ -0,0 +1,4 @@
+# Where to store files
+Here is a place to put files used by the roles.
+
+You can also put them in the default ansibles "files" directory (files folder aside of playbook files)
diff --git a/roles/crowdstrike/tasks/install-crowdstrike-redhat.yml b/roles/crowdstrike/tasks/install-crowdstrike-redhat.yml
new file mode 100644
index 0000000..5fb4f8d
--- /dev/null
+++ b/roles/crowdstrike/tasks/install-crowdstrike-redhat.yml
@@ -0,0 +1,33 @@
+---
+- name: RedHat-copy Crowdstrike agent install script
+ copy:
+ src: "{{ download_dir | default('.', true)}}/{{ Crowdstrike_version_rh }}"
+ dest: "/opt/{{ Crowdstrike_version_rh }}"
+
+- name: RedHat-Install Crowdstrike agent
+ yum:
+ name: "/opt/{{ Crowdstrike_version_rh }}"
+ state: present
+
+- name: RedHat-Configuring the CrowdStrike Falcon Service with the Customer ID ...
+ shell: "./falconctl -s -f --apd=true --cid={{ Crowdstrike_cid }}"
+ args:
+ chdir: /opt/CrowdStrike/
+ executable: /bin/sh
+
+- name: RedHat-Starting the CrowdStrike Falcon Service ...
+ service:
+ name: falcon-sensor
+ enabled: True
+ state: restarted
+
+- name: RedHat-Check Crowdstrike obtained ID else fail
+ shell: "./falconctl -g --aid"
+ args:
+ chdir: /opt/CrowdStrike/
+ executable: /bin/sh
+ register: crowd_result
+ failed_when: "'aid is not set' in crowd_result.stdout"
+ retries: 6
+ until: crowd_result is succeeded
+ delay: 30
diff --git a/roles/crowdstrike/tasks/install-crowdstrike-ubuntu.yml b/roles/crowdstrike/tasks/install-crowdstrike-ubuntu.yml
new file mode 100644
index 0000000..cb17ea3
--- /dev/null
+++ b/roles/crowdstrike/tasks/install-crowdstrike-ubuntu.yml
@@ -0,0 +1,41 @@
+---
+- name: Ubuntu-Checking to see if Crowdstrike is already installed
+ command: /bin/bash -c "yum info falcon-sensor"
+ register: crowd_installed
+ changed_when: false
+ ignore_errors: true
+
+- name: Ubuntu-Download Crowdstrike agent install script
+ get_url:
+ url: "http://{{ katelloURL }}/pulp/isos/NeXT/Library/custom/Misc/Misc-zip-packages/{{ Crowdstrike_version_deb }}"
+ dest: "/opt/{{ Crowdstrike_version_deb }}"
+ mode: 0770
+ force: "yes"
+ when: crowd_installed is failed
+
+- name: Ubuntu-Install Crowdstrike agent
+ apt:
+ deb: "/opt/{{ Crowdstrike_version_deb }}"
+ state: present
+ when: crowd_installed is failed
+
+- name: Ubuntu-Configuring the CrowdStrike Falcon Service with the Customer ID ...
+ shell: "./falconctl -s -f --cid={{ Crowdstrike_cid }}"
+ args:
+ chdir: /opt/CrowdStrike/
+ executable: /bin/sh
+ when: crowd_installed is failed
+
+- name: Ubuntu-Configuring the CrowdStrike Falcon Service Assign a unique ID...
+ shell: "./falconctl -d -f --aid"
+ args:
+ chdir: /opt/CrowdStrike/
+ executable: /bin/sh
+ when: crowd_installed is failed
+
+- name: Ubuntu-Starting the CrowdStrike Falcon Service ...
+ service:
+ name: falcon-sensor
+ enabled: True
+ state: started
+ when: crowd_installed is failed
diff --git a/roles/crowdstrike/tasks/install-crowdstrike-windows.yml b/roles/crowdstrike/tasks/install-crowdstrike-windows.yml
new file mode 100644
index 0000000..d806cdf
--- /dev/null
+++ b/roles/crowdstrike/tasks/install-crowdstrike-windows.yml
@@ -0,0 +1,100 @@
+---
+- name: Windows-Add or update registry path Dnscache, with dword entry 'Type', and containing 0x00000020 as the hex value
+ win_regedit:
+ path: HKLM:\SYSTEM\CurrentControlSet\services\Dnscache
+ name: Type
+ data: 0x00000020
+ type: dword
+
+- name: Windows-Checking to see if Crowdstrike is already installed
+ win_shell: |
+ Get-Service -Name "CSFalconService"
+ register: crowd_installed
+ changed_when: false
+ ignore_errors: true
+
+- name: Windows-Check if services are installed and running
+ win_service:
+ name: "{{ item }}"
+ state: started
+ with_items:
+ - nsi
+ - BFE
+ - Power
+ - lmhosts
+ - WinHttpAutoProxySvc
+ - Dhcp
+ when: crowd_installed is failed
+
+- name: Windows-Disable IE enhanced security
+ win_shell: 'Set-ItemProperty -Path "{{ Emplacement_Clef_Securite }}{{ item.Clef }}" -Name IsInstalled -Value 0'
+ with_items:
+ - { Clef: "{{ Clef_Securite_Admin }}" }
+ - { Clef: "{{ Clef_Securite_Users }}" }
+ vars:
+ Emplacement_Clef_Securite: 'HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\'
+ Clef_Securite_Admin: '{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}'
+ Clef_Securite_Users: '{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}'
+ when: crowd_installed is failed
+ ignore_errors: yes #Keep ignore for non server OS
+
+- name: Windows-Add Windows Defender exclusions
+ win_shell: Add-MpPreference -{{ item.ExclusionType }} "{{ item.valeur }}"
+ with_items:
+ - { ExclusionType: ExclusionPath, valeur: 'D:\' }
+ - { ExclusionType: ExclusionPath, valeur: 'C:\ProgramData\' }
+ - { ExclusionType: ExclusionPath, valeur: 'C:\Users\' }
+ - { ExclusionType: ExclusionExtension, valeur: '.exe' }
+ when: crowd_installed is failed
+
+- name: Instal Crowdstrike agent
+ win_package:
+ product_id: '{D339C288-2EEA-49A3-B10F-979FC2715A2C}'
+ path: http://{{ katelloURL }}/pulp/isos/NeXT/Library/custom/Misc/Misc-zip-packages/{{ Crowdstrike_version_win }}
+ arguments: /install /quiet /norestart CID={{ Crowdstrike_cid }} VDI=1
+ state: present
+ when: crowd_installed is failed
+ register: result
+ retries: 1
+ until: result is succeeded
+ delay: 15
+
+- name: Windows-Add or update registry with binary entry
+ win_regedit:
+ path: 'HKLM:\SYSTEM\CrowdStrike\{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}\{16e0423f-7058-48c9-a204-725362b67639}'
+ name: Default
+ data: [0x03,0x00,0x00,0x00]
+ type: binary
+ when: crowd_installed is failed
+
+- name: Windows-Check if CSFalconService is running
+ win_service:
+ name: CSFalconService
+ state: started
+ when: crowd_installed is failed
+
+- name: Windows-Check Crowdstrike obtained ID else fail
+ win_shell: '.\CSDeviceControlSupportTool.exe {{ Crowdstrike_cid }} -c showrules'
+ args:
+ chdir: 'C:\Program Files\CrowdStrike'
+ register: crowd_result
+ failed_when: "'Failed' in crowd_result.stdout"
+ retries: 6
+ until: crowd_result is succeeded
+ delay: 30
+ when: crowd_installed is failed
+
+- name: 'Windows-Windows defender Exclusions cleanup'
+ win_shell: "{{ item.Command }}"
+ with_items:
+ - { Command: '( Get-MpPreference ).ExclusionPath | foreach { Remove-MpPreference -ExclusionPath $_.ToString()}' }
+ - { Command: '( Get-MpPreference ).ExclusionProcess | foreach { Remove-MpPreference -ExclusionProcess $_.ToString()}' }
+ when: crowd_installed is failed
+
+- name: 'Windows-Enable IE enhanced security'
+ win_shell: 'Set-ItemProperty -Path "{{ Emplacement_Clef_Securite }}{{ item.Clef }}" -Name IsInstalled -Value 1'
+ with_items:
+ - { Clef: "{{ Clef_Securite_Admin }}" }
+ - { Clef: "{{ Clef_Securite_Users }}" }
+ when: crowd_installed is failed
+ ignore_errors: yes #Keep ignore for non server OS
diff --git a/roles/crowdstrike/tasks/main.yml b/roles/crowdstrike/tasks/main.yml
new file mode 100644
index 0000000..56d0e0b
--- /dev/null
+++ b/roles/crowdstrike/tasks/main.yml
@@ -0,0 +1,9 @@
+---
+- include: install-crowdstrike-redhat.yml
+ when: ansible_facts.os_family == "RedHat"
+
+- include: install-crowdstrike-ubuntu.yml
+ when: ansible_facts.os_family == "Debian"
+
+- include: install-crowdstrike-windows.yml
+ when: ansible_facts.os_family == "Windows"
diff --git a/roles/iptables/LICENSE b/roles/iptables/LICENSE
new file mode 100644
index 0000000..3877ae0
--- /dev/null
+++ b/roles/iptables/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/roles/iptables/README.md b/roles/iptables/README.md
new file mode 100644
index 0000000..f635022
--- /dev/null
+++ b/roles/iptables/README.md
@@ -0,0 +1,2 @@
+# iptables
+A role to update iptables rules and save them
diff --git a/roles/iptables/defaults/main.yml b/roles/iptables/defaults/main.yml
new file mode 100644
index 0000000..882d114
--- /dev/null
+++ b/roles/iptables/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+iptables_config_file: "/etc/sysconfig/iptables"
+iptables_rules: []
+...
diff --git a/roles/iptables/tasks/main.yml b/roles/iptables/tasks/main.yml
new file mode 100644
index 0000000..cdc92e5
--- /dev/null
+++ b/roles/iptables/tasks/main.yml
@@ -0,0 +1,79 @@
+---
+- name: Ensure iptables is present
+ apt:
+ name: 'iptables'
+ update_cache: true
+ state: present
+ when: ansible_facts.os_family == "Debian"
+- name: Ensure iptables is present
+ yum:
+ name: 'iptables'
+ update_cache: true
+ state: present
+ when: ansible_facts.os_family == "RedHat"
+
+- name: Save current iptable config if exist
+ copy:
+ dest: "{{ iptables_config_file }}.fallback"
+ src: "{{ iptables_config_file }}"
+ remote_src: yes
+ failed_when: false
+
+- name: Apply rules
+ iptables:
+ ip_version: "{{ item.ip_version | default('ipv4', true) }}"
+ action: "{{ item.action | default(omit, true) }}"
+ rule_num: "{{ item.rule_num | default(omit, true) }}"
+ chain: "{{ item.chain | default('INPUT', true) }}"
+ flush: "{{ item.flush | default(omit, true) }}"
+ policy: "{{ item.policy | default(omit, true) }}"
+ table: "{{ item.table | default('filter', true) }}"
+ source: "{{ item.source | default(omit, true) }}"
+ destination: "{{ item.destination | default(omit, true) }}"
+ src_range: "{{ item.src_range | default(omit, true) }}"
+ dst_range: "{{ item.dst_range | default(omit, true) }}"
+ source_port: "{{ item.source_port | default(omit, true) }}"
+ destination_port: "{{ item.destination_port | default(omit, true) }}"
+ protocol: "{{ item.protocol | default(omit, true) }}"
+ icmp_type: "{{ item.icmp_type | default(omit, true) }}"
+ in_interface: "{{ item.in_interface | default(omit, true) }}"
+ out_interface: "{{ item.out_interface | default(omit, true) }}"
+ goto: "{{ item.goto | default(omit, true) }}"
+ jump: "{{ item.jump | default(omit, true) }}"
+ cstate: "{{ item.cstate | default(omit, true) }}"
+ fragment: "{{ item.fragment | default(omit, true) }}"
+ gateway: "{{ item.gateway | default(omit, true) }}"
+ gid_owner: "{{ item.gid_owner | default(omit, true) }}"
+ uid_owner: "{{ item.uid_owner | default(omit, true) }}"
+ limit: "{{ item.limit | default(omit, true) }}"
+ limit_burst: "{{ item.limit_burst | default(omit, true) }}"
+ log_level: "{{ item.log_level | default(omit, true) }}"
+ log_prefix: "{{ item.log_prefix | default(omit, true) }}"
+ match: "{{ item.match | default(omit, true) }}"
+ reject_with: "{{ item.reject_with | default(omit, true) }}"
+ set_counters: "{{ item.set_counters | default(omit, true) }}"
+ set_dscp_mark: "{{ item.set_dscp_mark | default(omit, true) }}"
+ set_dscp_mark_class: "{{ item.set_dscp_mark_class | default(omit, true) }}"
+ syn: "{{ item.syn | default('ignore', true) }}"
+ tcp_flags: "{{ item.tcp_flags | default(omit, true) }}"
+ to_source: "{{ item.to_source | default(omit, true) }}"
+ to_destination: "{{ item.to_destination | default(omit, true) }}"
+ to_ports: "{{ item.to_ports | default(omit, true) }}"
+ state: "{{ item.state | default('present', true) }}"
+ with_items: "{{ iptables_rules }}"
+
+
+- name: Ensure iptables service is running
+ service:
+ name: iptables
+ state: started
+ enabled: yes
+
+- name: Save current iptables rules
+ shell: "iptables-save > {{ iptables_config_file }} >> {{ iptables_config_file }}"
+
+- name: Reload saved iptables rules
+ service:
+ name: iptables
+ state: reloaded
+...
diff --git a/roles/known_hosts/LICENSE b/roles/known_hosts/LICENSE
new file mode 100644
index 0000000..3877ae0
--- /dev/null
+++ b/roles/known_hosts/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/roles/known_hosts/README.md b/roles/known_hosts/README.md
new file mode 100644
index 0000000..41aa133
--- /dev/null
+++ b/roles/known_hosts/README.md
@@ -0,0 +1,3 @@
+# known_hosts
+A role to update ssh_known_hosts
+This is mostly useful for ansible control node
diff --git a/roles/known_hosts/defaults/main.yml b/roles/known_hosts/defaults/main.yml
new file mode 100644
index 0000000..ae1cd42
--- /dev/null
+++ b/roles/known_hosts/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+clean_known_hosts: True
+...
diff --git a/roles/known_hosts/tasks/main.yml b/roles/known_hosts/tasks/main.yml
new file mode 100644
index 0000000..1742c9a
--- /dev/null
+++ b/roles/known_hosts/tasks/main.yml
@@ -0,0 +1,37 @@
+---
+- name: Ensure ssh dir exist
+ file:
+ path: "~/.ssh"
+ state: directory
+ mode: 0750
+ delegate_to: localhost
+
+- name: Ensure known_hosts file exist
+ copy:
+ content: ""
+ dest: "~/.ssh/known_hosts"
+ force: no
+ mode: 0640
+ delegate_to: localhost
+
+- name: Remove ip
+ shell: "ssh-keygen -R {{ public_ipv4_address }}"
+ failed_when: false
+ changed_when: false
+ when:
+ - clean_known_hosts == True
+ delegate_to: localhost
+
+- name: Search ip
+ shell: "ssh-keygen -F {{ public_ipv4_address }}"
+ failed_when: false
+ changed_when: false
+ register: searchip
+ delegate_to: localhost
+
+- name: Insert
+ shell: "ssh-keyscan {{ public_ipv4_address }} >> ~/.ssh/known_hosts"
+ when:
+ - searchip.rc != 0
+ delegate_to: localhost
+...
diff --git a/roles/mkfs/LICENSE b/roles/mkfs/LICENSE
new file mode 100644
index 0000000..3877ae0
--- /dev/null
+++ b/roles/mkfs/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/roles/mkfs/README.md b/roles/mkfs/README.md
new file mode 100644
index 0000000..9ae2ae8
--- /dev/null
+++ b/roles/mkfs/README.md
@@ -0,0 +1,2 @@
+# Make filesystem
+A role to create filesystem on disks
diff --git a/roles/mkfs/defaults/main.yml b/roles/mkfs/defaults/main.yml
new file mode 100644
index 0000000..1c73300
--- /dev/null
+++ b/roles/mkfs/defaults/main.yml
@@ -0,0 +1,8 @@
+---
+devices: []
+# - device:
+# fstype:
+# opts:
+# resize:
+# override:
+...
diff --git a/roles/mkfs/tasks/main.yml b/roles/mkfs/tasks/main.yml
new file mode 100644
index 0000000..72e39f1
--- /dev/null
+++ b/roles/mkfs/tasks/main.yml
@@ -0,0 +1,10 @@
+---
+- name: Create filesystem
+ filesystem:
+ opts: "{{ item.opts | default(omit, true) }}"
+ force: "{{ item.override | default(false, true) }}"
+ resizefs: "{{ item.resize | default(true, true) }}"
+ dev: "{{ item.device }}"
+ fstype: "{{ item.fstype }}"
+ with_items: "{{ devices | default([], true) }}"
+...
diff --git a/roles/mount/LICENSE b/roles/mount/LICENSE
new file mode 100644
index 0000000..3877ae0
--- /dev/null
+++ b/roles/mount/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/roles/mount/README.md b/roles/mount/README.md
new file mode 100644
index 0000000..9ae2ae8
--- /dev/null
+++ b/roles/mount/README.md
@@ -0,0 +1,2 @@
+# Make filesystem
+A role to create filesystem on disks
diff --git a/roles/mount/defaults/main.yml b/roles/mount/defaults/main.yml
new file mode 100644
index 0000000..5c2c8e0
--- /dev/null
+++ b/roles/mount/defaults/main.yml
@@ -0,0 +1,9 @@
+---
+mounts: []
+# - path:
+# device:
+# fstype:
+# state:
+# opts:
+# fstab:
+...
diff --git a/roles/mount/tasks/main.yml b/roles/mount/tasks/main.yml
new file mode 100644
index 0000000..f8df8d3
--- /dev/null
+++ b/roles/mount/tasks/main.yml
@@ -0,0 +1,32 @@
+---
+- name: In mount state
+ include: "{{ item.state | default('mounted', true) }}.yml"
+ vars:
+ mount: "{{ item }}"
+ when:
+ - action is undefined
+ - (mounts | default([], true) | length) > 0
+ with_items: "{{ mounts }}"
+
+- name: Update/create mount
+ include: mounted.yml
+ vars:
+ mount: "{{ item }}"
+ when:
+ - action is defined
+ - action == 'mounted'
+ - item.state is undefined
+ - (mounts | default([], true) | length) > 0
+ with_items: "{{ mounts }}"
+
+- name: Delete mount
+ include: unmounted.yml
+ vars:
+ mount: "{{ item }}"
+ when:
+ - action is defined
+ - action == 'unmounted'
+ - item.state is undefined
+ - (mounts | default([], true) | length) > 0
+ with_items: "{{ mounts }}"
+...
diff --git a/roles/mount/tasks/mounted.yml b/roles/mount/tasks/mounted.yml
new file mode 100644
index 0000000..0e759bc
--- /dev/null
+++ b/roles/mount/tasks/mounted.yml
@@ -0,0 +1,14 @@
+---
+- name: Mount device
+ mount:
+ backup: "{{ mount.backup | default(false, true) }}"
+ dump: "{{ mount.dump | default(omit, true) }}"
+ passno: "{{ mount.passno | default(omit, true) }}"
+ fstab: "{{ mount.fstab | default(omit, true) }}"
+ opts: "{{ mount.opts | default(omit, true) }}"
+ boot: "{{ mount.boot | default(true, true) }}"
+ fstype: "{{ mount.fstype }}"
+ path: "{{ mount.path }}"
+ src: "{{ mount.device }}"
+ state: "mounted"
+...
diff --git a/roles/mount/tasks/unmounted.yml b/roles/mount/tasks/unmounted.yml
new file mode 100644
index 0000000..bbb9c66
--- /dev/null
+++ b/roles/mount/tasks/unmounted.yml
@@ -0,0 +1,8 @@
+---
+- name: Unmount device
+ mount:
+ fstab: "{{ mount.fstab | default(omit, true) }}"
+ path: "{{ mount.path }}"
+ src: "{{ mount.device }}"
+ state: "unmounted"
+...
diff --git a/roles/ntp_server/LICENSE b/roles/ntp_server/LICENSE
new file mode 100644
index 0000000..3877ae0
--- /dev/null
+++ b/roles/ntp_server/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/roles/ntp_server/README.md b/roles/ntp_server/README.md
new file mode 100644
index 0000000..352b2b1
--- /dev/null
+++ b/roles/ntp_server/README.md
@@ -0,0 +1,2 @@
+# NTP server
+A role to install and configure an ntp server
diff --git a/roles/ntp_server/defaults/main.yml b/roles/ntp_server/defaults/main.yml
new file mode 100644
index 0000000..1e53074
--- /dev/null
+++ b/roles/ntp_server/defaults/main.yml
@@ -0,0 +1,9 @@
+---
+pools: []
+allowed_subnets: []
+# - net: "192.168.0.0"
+# mask: "255.255.255.0"
+driftfile: "/var/lib/ntp/drift"
+logfile: "/var/log/messages"
+#keyfile: "/etc/ntp/keys"
+...
diff --git a/roles/ntp_server/tasks/main.yml b/roles/ntp_server/tasks/main.yml
new file mode 100644
index 0000000..d53f8f5
--- /dev/null
+++ b/roles/ntp_server/tasks/main.yml
@@ -0,0 +1,40 @@
+---
+- name: Include OS-specific variables.
+ include_vars: "{{ ansible_facts.os_family }}.yml"
+- name: install ntp
+ apt:
+ name:
+ - "{{ ntp_package | default('ntp', true) }}"
+ update_cache: true
+ state: present
+ when: ansible_facts.os_family == "Debian"
+- name: install ntp
+ yum:
+ name:
+ - "{{ ntp_package | default('ntp', true) }}"
+ update_cache: true
+ state: present
+ when: ansible_facts.os_family == "RedHat"
+- name: Ensure log dir exist
+ file:
+ state: directory
+ path: "{{ logfile | dirname }}"
+- name: Ensure drift dir exist
+ file:
+ state: directory
+ path: "{{ driftfile | dirname }}"
+- name: set ntp configuration
+ template:
+ src: "{{ ntp_package }}.conf.j2"
+ dest: "{{ ntp_conf_file | default('/etc/ntp.conf', true) }}"
+ owner: root
+ group: root
+ mode: '0640'
+- name: Set and start ntp service
+ service:
+ enabled: true
+ name: "{{ ntp_daemon | default('ntpd', true) }}"
+ state: restarted
+- name: Show status service
+ shell: "systemctl status {{ ntp_daemon }}.service"
+...
diff --git a/roles/ntp_server/templates/chrony.conf.j2 b/roles/ntp_server/templates/chrony.conf.j2
new file mode 100644
index 0000000..a82a56a
--- /dev/null
+++ b/roles/ntp_server/templates/chrony.conf.j2
@@ -0,0 +1,57 @@
+#################################################################
+# File: chrony.conf
+# Generated by: Ansible
+#################################################################
+# Use public servers from the pool.ntp.org project.
+# Please consider joining the pool (http://www.pool.ntp.org/join.html).
+{% for server in pools %}
+server {{ server }} iburst
+{% endfor %}
+
+# -- CLIENT NETWORK -------
+# Permit systems on this network to synchronize with this
+# time service. Do not permit those systems to modify the
+# configuration of this service. Also, do not use those
+# systems as peers for synchronization.
+{% for subnet in allowed_subnets %}
+allow {{ (subnet.net + '/' + subnet.mask) | ipaddr('net') }}
+{% endfor %}
+
+#
+# Drift file. Put this in a directory which the daemon can write to.
+# No symbolic links allowed, either, since the daemon updates the file
+# by creating a temporary in the same directory and then rename()ing
+# it to the file.
+# Record the rate at which the system clock gains/losses time.# Record the rate at which the system clock gains/losses time.
+#
+driftfile {{ driftfile }}
+
+# Allow the system clock to be stepped in the first three updates
+# if its offset is larger than 1 second.
+makestep 1.0 3
+# Enable kernel synchronization of the real-time clock (RTC).
+rtcsync
+
+# Enable hardware timestamping on all interfaces that support it.
+#hwtimestamp *
+
+# Increase the minimum number of selectable sources required to adjust
+# the system clock.
+#minsources 2
+
+# Serve time even if not synchronized to a time source.
+#local stratum 10
+
+#
+# Key file containing the keys and key identifiers used when operating
+# with symmetric key cryptography.
+#
+{% if keyfile is defined %}
+keyfile {{ keyfile }}
+{% endif %}
+
+# Specify directory for log files.
+logdir {{ logfile | dirname}}
+
+# Select which information is logged.
+#log measurements statistics tracking
diff --git a/roles/ntp_server/templates/ntp.conf.j2 b/roles/ntp_server/templates/ntp.conf.j2
new file mode 100644
index 0000000..5394d1f
--- /dev/null
+++ b/roles/ntp_server/templates/ntp.conf.j2
@@ -0,0 +1,86 @@
+#################################################################
+# File: ntp.conf
+# Generated by: Ansible
+#################################################################
+# Allow the system clock to be stepped in the first three updates
+# if its offset is larger than 1 second.
+makestep 1.0 3
+
+# Enable kernel synchronization of the real-time clock (RTC).
+rtcsync
+
+# Where to log
+logfile {{ logfile }}
+
+# Permit all access over the loopback interface.
+restrict default kod nomodify notrap nopeer noquery
+restrict -6 default kod nomodify notrap nopeer noquery
+restrict 127.0.0.1
+restrict -6 ::1
+
+# -- CLIENT NETWORK -------
+# Permit systems on this network to synchronize with this
+# time service. Do not permit those systems to modify the
+# configuration of this service. Also, do not use those
+# systems as peers for synchronization.
+{% for subnet in allowed_subnets %}
+restrict {{ subnet.net }} mask {{ subnet.mask | default("255.255.255.0", true) }} nomodify notrap
+{% endfor %}
+
+# --- NTP SERVERS -----
+
+# or remove the default restrict line
+# Permit time synchronization with our time source, but do not
+# permit the source to query or modify the service on this system.
+{% for server in pools %}
+restrict {{ server }} mask 255.255.255.255 nomodify notrap noquery
+server {{ server }} iburst
+{% endfor %}
+
+# --- GENERAL CONFIGURATION ---
+
+#
+# Undisciplined Local Clock. This is a fake driver intended for backup
+# and when no outside source of synchronized time is available. The
+# default stratum is usually 3, but in this case we elect to use stratum
+# 0. Since the server line does not have the prefer keyword, this driver
+# is never used for synchronization, unless no other other
+# synchronization source is available. In case the local host is
+# controlled by some external source, such as an external oscillator or
+# another protocol, the prefer keyword would cause the local host to
+# disregard all other synchronization sources, unless the kernel
+# modifications are in use and declare an unsynchronized condition.
+#
+server 127.127.1.0
+fudge 127.127.1.0 stratum 10
+
+#
+# Drift file. Put this in a directory which the daemon can write to.
+# No symbolic links allowed, either, since the daemon updates the file
+# by creating a temporary in the same directory and then rename()ing
+# it to the file.
+# Record the rate at which the system clock gains/losses time.# Record the rate at which the system clock gains/losses time.
+#
+driftfile {{ driftfile }}
+
+#
+# Keys file. If you want to diddle your server at run time, make a
+# keys file (mode 600 for sure) and define the key number to be
+# used for making requests.
+#
+
+#
+# Key file containing the keys and key identifiers used when operating
+# with symmetric key cryptography.
+#
+{% if keyfile is defined %}
+keys {{ keyfile }}
+{% endif %}
+
+#
+# Disable the monitoring facility to prevent amplification attacks using ntpdc
+# monlist command when default restrict does not include the noquery flag. See
+# CVE-2013-5211 for more details.
+# Note: Monitoring will not be disabled with the limited restriction flag.
+#
+disable monitor
diff --git a/roles/ntp_server/vars/Debian.yml b/roles/ntp_server/vars/Debian.yml
new file mode 100644
index 0000000..c26a63d
--- /dev/null
+++ b/roles/ntp_server/vars/Debian.yml
@@ -0,0 +1,6 @@
+---
+ntp_daemon: ntp
+ntp_package: ntp
+ntp_conf_file: /etc/ntp.conf
+driftfile: /var/lib/ntp/drift
+...
diff --git a/roles/ntp_server/vars/RedHat.yml b/roles/ntp_server/vars/RedHat.yml
new file mode 100644
index 0000000..46a1185
--- /dev/null
+++ b/roles/ntp_server/vars/RedHat.yml
@@ -0,0 +1,6 @@
+---
+ntp_daemon: chronyd
+ntp_package: chrony
+ntp_conf_file: /etc/chrony.conf
+driftfile: /var/lib/ntp/drift
+...
diff --git a/roles/powerdns.pdns/.travis.yml b/roles/powerdns.pdns/.travis.yml
new file mode 100644
index 0000000..1531294
--- /dev/null
+++ b/roles/powerdns.pdns/.travis.yml
@@ -0,0 +1,30 @@
+---
+
+language: python
+python: 2.7
+
+sudo: required
+
+# Enable the docker service
+services:
+ - docker
+
+# Parallel testing of the supported
+# Ansible versions
+env:
+ matrix:
+ - ANSIBLE=2.2
+ - ANSIBLE=2.3
+ - ANSIBLE=2.4
+ - ANSIBLE=2.5
+
+# Install tox
+install:
+ - pip install tox-travis
+
+# Test the current PowerDNS Authoritative Server stable release
+script:
+ - tox -- molecule test -s pdns-41
+
+notifications:
+ webhooks: https://galaxy.ansible.com/api/v1/notifications/
diff --git a/roles/powerdns.pdns/.yamllint b/roles/powerdns.pdns/.yamllint
new file mode 100644
index 0000000..4267219
--- /dev/null
+++ b/roles/powerdns.pdns/.yamllint
@@ -0,0 +1,16 @@
+extends: default
+
+rules:
+
+ # Disable line-length and truthy values reporting
+ line-length: disable
+ truthy: disable
+
+ # Max 1 space to separate the elements in brakets
+ braces:
+ max-spaces-inside: 1
+
+ # Max 1 space in empty brackets
+ brackets:
+ min-spaces-inside-empty: 0
+ max-spaces-inside-empty: 1
diff --git a/roles/powerdns.pdns/CHANGELOG.md b/roles/powerdns.pdns/CHANGELOG.md
new file mode 100644
index 0000000..76cef76
--- /dev/null
+++ b/roles/powerdns.pdns/CHANGELOG.md
@@ -0,0 +1,74 @@
+## v1.4.0 (2018-12-02)
+
+BUG FIXES:
+- Ensure that lists are expanded in the PowerDNS configuration template ([\#55](https://github.com/PowerDNS/pdns-ansible/pull/55))
+
+NEW FEATURES:
+- Add an option (`pdns_disable_handlers`) to disable the automated restart of the service on configuration changes ([\#54](https://github.com/PowerDNS/pdns-ansible/pull/54))
+
+## v1.3.0 (2018-07-13)
+
+NEW FEATURES:
+- Allow to manage systemd overrides ([\#53](https://github.com/PowerDNS/pdns-ansible/pull/53))
+
+IMPROVEMENTS:
+- Stricter `pdns_config_dir` and `pdns_config['include-dir']` folders permissions ([\#53](https://github.com/PowerDNS/pdns-ansible/pull/53))
+- Improved documentation ([\#52](https://github.com/PowerDNS/pdns-ansible/pull/52))
+- Upgrade molecule to 2.14.0 ([\#51](https://github.com/PowerDNS/pdns-ansible/pull/51))
+- Improved systemd support in the tests ([\#49](https://github.com/PowerDNS/pdns-ansible/pull/49))
+
+## v1.2.1 (2018-04-06)
+
+BUG FIXES:
+- Fix the name of the PostgreSQL backend on RHEL
+
+## v1.2.0 (2018-04-05)
+
+NEW FEATURES:
+- Debug packages installation ([\#47](https://github.com/PowerDNS/pdns-ansible/pull/47))
+
+IMPROVEMENTS:
+- Improved test-suite ([\#47](https://github.com/PowerDNS/pdns-ansible/pull/47))
+- Improved config files permissions ([\#45](https://github.com/PowerDNS/pdns-ansible/pull/45))
+
+## v1.1.0 (2017-11-25)
+
+IMPROVEMENTS:
+- Testing across multiple ansible versions with tox ([\#43](https://github.com/PowerDNS/pdns-ansible/pull/43))
+
+BUG FIXES:
+- Fixed test cases and hardened file permissions ([\#42](https://github.com/PowerDNS/pdns-ansible/pull/42))
+
+## v1.0.0 (2017-10-27)
+
+IMPROVEMENTS:
+- Sort configuration keys ([\#35](https://github.com/PowerDNS/pdns-ansible/pull/35), [\#37](https://github.com/PowerDNS/pdns-ansible/pull/37))
+
+BUG FIXES:
+- Fix the logic handling the different packages versions for Debian and CentOS ([\#43](https://github.com/PowerDNS/pdns-ansible/pull/43))
+- Fix a few typos in the README file ([\#39](https://github.com/PowerDNS/pdns-ansible/pull/39))
+
+## v0.1.1 (2017-10-10)
+
+NEW FEATURES:
+- Install specific PowerDNS Authoritative Server versions ([\#34](https://github.com/PowerDNS/pdns-ansible/pull/34))
+
+IMPROVEMENTS:
+- Add support to the PowerDNS Authoritative Server 4.1.x releases ([\#33](https://github.com/PowerDNS/pdns-ansible/pull/33))
+- Fixing minor linter issues with whitespace ([\#30](https://github.com/PowerDNS/pdns-ansible/pull/30))
+
+BUG FIXES:
+- Fix Ubuntu APT repositories pinning ([\#32](https://github.com/PowerDNS/pdns-ansible/pull/32))
+
+## v0.1.0 (2017-06-27)
+
+Initial release.
+
+NEW FEATURES:
+- PostgreSQL and SQLite databases initialization
+- PowerDNS Authoritative Server installation and configuration Red-Hat and Debian support
+- Continuous testing with TravisCI
+
+IMPROVEMENTS:
+- Switch to the MIT License ([\#27](https://github.com/PowerDNS/pdns-ansible/pull/27))
+- Overall role refactoring ([\#28](https://github.com/PowerDNS/pdns-ansible/pull/28))
diff --git a/roles/powerdns.pdns/LICENSE b/roles/powerdns.pdns/LICENSE
new file mode 100644
index 0000000..7984329
--- /dev/null
+++ b/roles/powerdns.pdns/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 PowerDNS.COM BV
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/roles/powerdns.pdns/README.md b/roles/powerdns.pdns/README.md
new file mode 100644
index 0000000..d33d490
--- /dev/null
+++ b/roles/powerdns.pdns/README.md
@@ -0,0 +1,337 @@
+# Ansible Role: PowerDNS Authoritative Server
+
+[](https://travis-ci.org/PowerDNS/pdns-ansible)
+[](https://opensource.org/licenses/MIT)
+[](https://galaxy.ansible.com/PowerDNS/pdns)
+[](https://github.com/PowerDNS/pdns-ansible/tags)
+
+An Ansible role created by the folks behind PowerDNS to setup the [PowerDNS Authoritative Server](https://docs.powerdns.com/authoritative/).
+
+## Requirements
+
+An Ansible 2.2 or higher installation.
+
+## Dependencies
+
+None.
+
+## Role Variables
+
+Available variables are listed below, along with their default values (see `defaults/main.yml`):
+
+```yaml
+pdns_install_repo: ""
+```
+
+By default, the PowerDNS Authoritative Server is installed from the software repositories configured on the target hosts.
+
+```yaml
+# Install the PowerDNS Authoritative Server from the 'master' official repository
+- hosts: all
+ roles:
+ - { role: PowerDNS.pdns,
+ pdns_install_repo: "{{ pdns_auth_powerdns_repo_master }}"
+
+# Install the PowerDNS Authoritative Server from the '4.0.x' official repository
+- hosts: all
+ roles:
+ - { role: PowerDNS.pdns,
+ pdns_install_repo: "{{ pdns_auth_powerdns_repo_40 }}"
+
+# Install the PowerDNS Authoritative Server from the '4.1.x' official repository
+- hosts: all
+ roles:
+ - { role: PowerDNS.pdns,
+ pdns_install_repo: "{{ pdns_auth_powerdns_repo_41 }}"
+```
+
+The examples above, show how to install the PowerDNS Authoritative Server from the official PowerDNS repositories
+(see the complete list of pre-defined repos in `vars/main.yml`).
+
+```yaml
+- hosts: all
+ vars:
+ pdns_install_repo:
+ name: "powerdns" # the name of the repository
+ apt_repo_origin: "example.com" # used to pin the PowerDNS packages to the provided repository
+ apt_repo: "deb http://example.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}/pdns main"
+ gpg_key: "http://example.com/MYREPOGPGPUBKEY.asc" # repository public GPG key
+ gpg_key_id: "MYREPOGPGPUBKEYID" # to avoid to reimport the key each time the role is executed
+ yum_repo_baseurl: "http://example.com/centos/$basearch/$releasever/pdns"
+ yum_debug_symbols_repo_baseurl: "http://example.com/centos/$basearch/$releasever/pdns/debug"
+ roles:
+ - { role: PowerDNS.pdns }
+```
+
+It is also possible to install the PowerDNS Authoritative Server from custom repositories as demonstrated in the example above.
+
+```yaml
+ pdns_install_epel: True
+```
+
+By default, install EPEL to satisfy some PowerDNS Authoritative Server dependencies like `protobuf`.
+To skip the installtion of EPEL set `pdns_install_epel` to `False`.
+
+```yaml
+pdns_package_name: "{{ default_pdns_package_name }}"
+```
+
+The name of the PowerDNS Authoritative Server package, `pdns` on RedHat-like systems and `pdns-server` on Debian-like systems.
+
+```yaml
+pdns_package_version: ""
+```
+
+Optionally, allow to set a specific version of the PowerDNS Authoritative Server package to be installed.
+
+```yaml
+pdns_install_debug_symbols_package: False
+```
+
+Install the PowerDNS Authoritative Server debug symbols.
+
+```yaml
+pdns_debug_symbols_package_name: "{{ default_pdns_debug_symbols_package_name }}"
+```
+
+The name of the PowerDNS Authoritative Server debug package to be installed when `pdns_install_debug_symbols_package` is `True`,
+`pdns-debuginfo` on RedHat-like systems and `pdns-server-dbg` on Debian-like systems.
+
+```yaml
+pdns_user: pdns
+pdns_group: pdns
+```
+
+The user and group the PowerDNS Authoritative Server process will run as.
+**NOTE**: This role does not create the user or group as we assume that they've been created
+by the package or other roles.
+
+```yaml
+pdns_service_name: "pdns"
+```
+
+Name of the PowerDNS service.
+
+```yaml
+pdns_flush_handlers: False
+```
+
+Force the execution of the handlers at the end of the role.
+**NOTE:** This is required if using this role to configure multiple PowerDNS instances in the same play.
+See PowerDNS Authoritative Server virtual hosting https://doc.powerdns.com/md/authoritative/running/#starting-virtual-instances-with-system.
+
+```yaml
+pdns_disable_handlers: False
+```
+
+Disable automated service restart on configuration changes.
+
+```yaml
+pdns_config_dir: "{{ default_pdns_config_dir }}"
+pdns_config_file: "pdns.conf"
+```
+
+PowerDNS Authoritative Server configuration file and directory.
+
+```yaml
+pdns_config: {}
+```
+
+Dictionary containing the PowerDNS Authoritative Server configuration.
+**NOTE:** The PowerDNS backends configuration and the `config-dir`, `setuid` and `setgid` directives must be configured through the `pdns_user`, `pdns_group` and `pdns_backends` role variables (see `templates/pdns.conf.j2`).
+For example:
+
+```yaml
+pdns_config:
+ master: yes
+ slave: no
+ local-address: '192.0.2.53'
+ local-ipv6: '2001:DB8:1::53'
+ local-port: '5300'
+```
+
+configures PowerDNS Authoritative Server to listen incoming DNS requests on port 5300.
+
+```yaml
+pdns_service_overrides: {}
+```
+
+Dict with overrides for the service (systemd only).
+This can be used to change any systemd settings in the `[Service]` category.
+
+```yaml
+pdns_backends:
+ bind:
+ config: '/dev/null'
+```
+
+Dictionary declaring all the backends you'd like to enable. You can use
+multiple backends of the same kind by using the `{backend}:{instance_name}` syntax.
+For example:
+
+```yaml
+pdns_backends:
+ 'gmysql:one':
+ 'user': root
+ 'host': 127.0.0.1
+ 'password': root
+ 'dbname': pdns
+ 'gmysql:two':
+ 'user': pdns_user
+ 'host': 192.0.2.15
+ 'password': my_password
+ 'dbname': dns
+ 'bind':
+ 'config': '/etc/named/named.conf'
+ 'hybrid': yes
+ 'dnssec-db': '{{ pdns_config_dir }}/dnssec.db'
+```
+
+By default this role starts just the bind-backend with an empty config file.
+
+```yaml
+pdns_mysql_databases_credentials: {}
+```
+
+Administrative credentials for the MySQL backend used to create the PowerDNS Authoritative Server databases and users.
+For example:
+
+```yaml
+pdns_mysql_databases_credentials:
+ 'gmysql:one':
+ 'priv_user': root
+ 'priv_password': my_first_password
+ 'priv_host':
+ - "localhost"
+ - "%"
+ 'gmysql:two':
+ 'priv_user': someprivuser
+ 'priv_password': my_second_password
+ 'priv_host':
+ - "localhost"
+```
+
+Notice that this must only containes the credentials
+for the `gmysql` backends provided in `pdns_backends`.
+
+```yaml
+pdns_sqlite_databases_locations: []
+```
+
+Locations of the SQLite3 databases that have to be created if using the
+`gsqlite3` backend.
+
+## Example Playbooks
+
+Run as a master using the bind backend (when you already have a `named.conf` file):
+
+```yaml
+- hosts: ns1.example.net
+ roles:
+ - { role: PowerDNS.pdns }
+ vars:
+ pdns_config:
+ master: true
+ local-address: '192.0.2.53'
+ pdns_backends:
+ bind:
+ config: '/etc/named/named.conf'
+```
+
+Install the latest '41' build of PowerDNS Authoritative Server enabling the MySQL backend.
+Provides also the MySQL administrative credentials to automatically create and initialize the PowerDNS Authoritative Server user and database:
+
+```yaml
+- hosts: ns2.example.net
+ roles:
+ - { role: PowerDNS.pdns }
+ vars:
+ pdns_config:
+ master: true
+ slave: false
+ local-address: '192.0.2.77'
+ pdns_backends:
+ gmysql:
+ host: 192.0.2.120
+ port: 3306
+ user: powerdns
+ password: P0w3rDn5
+ dbname: pdns
+ pdns_mysql_databases_credentials:
+ gmysql:
+ priv_user: root
+ priv_password: myrootpass
+ priv_host:
+ - "%"
+ pdns_install_repo: "{{ pdns_auth_powerdns_repo_41 }}"
+```
+
+**NOTE:** In this case the role will use the credentials provided in `pdns_mysql_databases_credentials` to automatically create and initialize the user (`user`, `password`) and database (`dbname`) connecting to the MySQL server (`host`, `port`).
+
+Configure PowerDNS Authoritative Server in 'master' mode reading zones from two different PostgreSQL databases:
+
+```yaml
+- hosts: ns2.example.net
+ roles:
+ - { role: PowerDNS.pdns }
+ vars:
+ pdns_config:
+ master: true
+ local-port: 5300
+ local-address: '192.0.2.111'
+ pdns_backends:
+ 'gpgsql:serverone':
+ host: 192.0.2.124
+ user: powerdns
+ password: P0w3rDn5
+ dbname: pdns2
+ 'gpgsql:otherserver':
+ host: 192.0.2.125
+ user: root
+ password: root
+ dbname: dns
+```
+
+Configure PowerDNS Authoritative Server to run with the `gsqlite3` backend.
+The SQLite database will be created and initialized by the role
+in the location specified by the `database_name` variable.
+
+```yaml
+- hosts: ns4.example.net
+ roles:
+ - { role: PowerDNS.pdns }
+ vars:
+ database_name: '/var/lib/powerdns/db.sqlite'
+ pdns_config:
+ master: true
+ slave: false
+ local-address: '192.0.2.73'
+ pdns_backends:
+ gsqlite3:
+ database: "{{ database_name }}"
+ dnssec: yes
+ pdns_sqlite_databases_locations:
+ - "{{ database_name }}"
+```
+
+## Changelog
+
+A detailed changelog of all the changes applied to the role is available [here](./CHANGELOG.md).
+
+## Testing
+
+Tests are performed by [Molecule](http://molecule.readthedocs.org/en/latest/).
+
+ $ pip install tox
+
+To test all the scenarios run
+
+ $ tox
+
+To run a custom molecule command
+
+ $ tox -e py27-ansible22 -- molecule test -s pdns-41
+
+## License
+
+MIT
diff --git a/roles/powerdns.pdns/defaults/main.yml b/roles/powerdns.pdns/defaults/main.yml
new file mode 100644
index 0000000..6d75ef8
--- /dev/null
+++ b/roles/powerdns.pdns/defaults/main.yml
@@ -0,0 +1,142 @@
+---
+
+# By default, no PowerDNS Authoritative Server repository will be configured by the role
+pdns_install_repo: ""
+
+# To install tje PowerDNS Authoritative Server from the 'master' official repository
+# use the following playbook snippet
+# - hosts: all
+# roles:
+# - { role: PowerDNS.pdns,
+# pdns_install_repo: "{{ pdns_auth_powerdns_repo_master }}"
+#
+# To install the PowerDNS Authoritative Server from the '4.0.x' official repository
+# use the following playbook snippet
+# - hosts: all
+# roles:
+# - { role: PowerDNS.pdns,
+# pdns_install_repo: "{{ pdns_auth_powerdns_repo_40 }}"
+#
+# To install the PowerDNS Authoritative Server from the '4.1.x' official repository
+# use the following playbook snippet
+# - hosts: all
+# roles:
+# - { role: PowerDNS.pdns,
+# pdns_install_repo: "{{ pdns_auth_powerdns_repo_41 }}"
+#
+# To make this role configure a custom repository and install the
+# PowerDNS Authoritative Server from it override the `pdns_install_repo` variable
+# as follows
+# - hosts: all
+# vars:
+# pdns_install_repo:
+# apt_repo_origin: "example.com" # Pin the PowerDNS packages to the provided repository origin
+# apt_repo: "deb http://example.com/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release | lower }}/pdns main"
+# gpg_key: "http://example.com/MYREPOGPGPUBKEY.asc" # repository public GPG key
+# gpg_key_id: "MYREPOGPGPUBKEYID" # to avoid to reimport the key each time the role is executed
+# yum_repo_baseurl: "http://example.com/centos/$basearch/$releasever/pdns"
+# name: "powerdns" # the name of the repository
+# roles:
+# - { role: PowerDNS.pdns }
+
+# Install the EPEL repository.
+# EPEL is needed to satisfy some PowerDNS Authoritative Server dependencies like protobuf
+pdns_install_epel: True
+
+# The name of the PowerDNS Authoritative Server package
+pdns_package_name: "{{ default_pdns_package_name }}"
+
+# Install a specific version of the PowerDNS Authoritative Server package
+# NB: The usage of this variable makes only sense on RedHat-like systems,
+# where each YUM repository can contains multiple versions of the same package.
+pdns_package_version: ""
+
+# Install the PowerDNS Authoritative Server debug symbols package
+pdns_install_debug_symbols_package: False
+
+# The name of the PowerDNS Authoritative Server debug symbols package
+pdns_debug_symbols_package_name: "{{ default_pdns_debug_symbols_package_name }}"
+
+# The user and group the PowerDNS Authoritative Server process will run as.
+# NOTE: at the moment, we don't create a user as we assume the package creates
+# a "pdns" user and group. If you change these variables, make sure to create
+# the user and groups before applying this role
+pdns_user: pdns
+pdns_group: pdns
+
+# Name of the PowerDNS Authoritative Server Service
+pdns_service_name: "pdns"
+
+# Force the execution of the handlers at the end of the role.
+# This is required if using this role to configure multiple pdns auth instance in the same single play.
+# See PowerDNS Authoritative Server virtual hosting https://doc.powerdns.com/md/authoritative/running/#starting-virtual-instances-with-system.
+pdns_flush_handlers: False
+
+# When True, disable the automated restart of the PowerDNS service
+pdns_disable_handlers: False
+
+# PowerDNS Authoritative Server configuration file and directory
+pdns_config_dir: "{{ default_pdns_config_dir }}"
+pdns_config_file: "pdns.conf"
+
+# Ddict containing all configuration options, except for backend
+# configuration and the "config-dir", "setuid" and "setgid" directives.
+pdns_config: {}
+# pdns_config:
+# master: yes
+# slave: no
+# local-address: '192.0.2.53'
+# local-ipv6: '2001:DB8:1::53'
+# local-port: '5300'
+
+# Dict with overrides for the service (systemd only)
+pdns_service_overrides: {}
+# pdns_service_overrides:
+# LimitNOFILE: 10000
+
+# Dictionary of packages that should be installed to enable the backends.
+# backendname: packagename
+pdns_backends_packages: "{{ default_pdns_backends_packages }}"
+
+# A dict with all the backends you'd like to configure.
+# This default starts just the bind-backend with an empty config file
+pdns_backends:
+ bind:
+ config: '/dev/null'
+# pdns_backends:
+# 'gmysql:one':
+# 'user': root
+# 'host': 127.0.0.1
+# 'password': root
+# 'dbname': pdns
+# 'gmysql:two':
+# 'user': pdns_user
+# 'host': 192.0.2.15
+# 'port': 3307
+# 'password': my_password
+# 'dbname': dns
+# 'bind':
+# 'config': '/etc/named/named.conf'
+# 'hybrid': yes
+# 'dnssec-db': '{{ pdns_config_dir }}/dnssec.db'
+
+# Administrative credentials to create the PowerDNS Authoritative Server MySQL backend database and user.
+pdns_mysql_databases_credentials: {}
+# pdns_mysql_databases_credentials:
+# 'gmysql:one':
+# 'priv_user': root
+# 'priv_password': my_first_password
+# 'priv_host':
+# - "localhost"
+# - "%"
+# 'gmysql:two':
+# 'priv_user': someprivuser
+# 'priv_password': my_second_password
+# 'priv_host':
+# - "localhost"
+
+# This will create the PowerDNS Authoritative Server backend SQLite database
+# in the given locations.
+# NOTE: Requries the SQLite CLI tools to be available in the machine and the gsqlite3
+# backend to be installed on the machine.
+pdns_sqlite_databases_locations: []
diff --git a/roles/powerdns.pdns/handlers/main.yml b/roles/powerdns.pdns/handlers/main.yml
new file mode 100644
index 0000000..19e4c58
--- /dev/null
+++ b/roles/powerdns.pdns/handlers/main.yml
@@ -0,0 +1,13 @@
+---
+
+- name: restart PowerDNS
+ service:
+ name: "{{ pdns_service_name }}"
+ state: restarted
+ sleep: 1 # the sleep is needed to make sure the service has been
+ when: not pdns_disable_handlers # correctly started after being stopped during restarts
+
+- name: reload systemd and restart PowerDNS
+ command: systemctl daemon-reload
+ notify: restart PowerDNS
+ when: not pdns_disable_handlers
diff --git a/roles/powerdns.pdns/meta/.galaxy_install_info b/roles/powerdns.pdns/meta/.galaxy_install_info
new file mode 100644
index 0000000..7938004
--- /dev/null
+++ b/roles/powerdns.pdns/meta/.galaxy_install_info
@@ -0,0 +1,2 @@
+install_date: Fri Dec 6 14:59:42 2019
+version: v1.4.0
diff --git a/roles/powerdns.pdns/meta/main.yml b/roles/powerdns.pdns/meta/main.yml
new file mode 100644
index 0000000..a616e4e
--- /dev/null
+++ b/roles/powerdns.pdns/meta/main.yml
@@ -0,0 +1,33 @@
+---
+
+galaxy_info:
+ author: PowerDNS Engineering Team
+ description: Install and configure the PowerDNS Authoritative DNS Server
+ company: PowerDNS.COM BV
+ license: MIT
+ min_ansible_version: 2.2
+ platforms:
+ - name: EL
+ versions:
+ - 6
+ - 7
+ - name: Debian
+ versions:
+ - jessie
+ - stretch
+ - name: Ubuntu
+ versions:
+ - trusty
+ - utopic
+ - vivid
+ - wily
+ - xenial
+ - bionic
+ galaxy_tags:
+ - system
+ - dns
+ - pdns
+ - powerdns
+ - pdns-auth
+
+dependencies: []
diff --git a/roles/powerdns.pdns/molecule/pdns-41/molecule.yml b/roles/powerdns.pdns/molecule/pdns-41/molecule.yml
new file mode 100644
index 0000000..80bfc98
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/pdns-41/molecule.yml
@@ -0,0 +1,94 @@
+---
+
+scenario:
+ name: pdns-41
+
+driver:
+ name: docker
+
+dependency:
+ name: galaxy
+
+platforms:
+ - name: centos-6
+ image: centos:6
+ groups:
+ - pdns
+
+ - name: centos-7
+ image: centos:7
+ dockerfile_tpl: centos-systemd
+ groups:
+ - pdns
+
+ - name: ubuntu-1604
+ image: ubuntu:16.04
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ - name: ubuntu-1710
+ image: ubuntu:17.10
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ - name: ubuntu-1804
+ image: ubuntu:18.04
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ - name: debian-8
+ image: debian:8
+ groups:
+ - pdns
+
+ - name: debian-9
+ image: debian:9
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ # In order to run the tests we need
+ # a MySQL container to be up & running
+ - name: mysql
+ image: mysql:5.7
+ env:
+ MYSQL_ROOT_PASSWORD: pdns
+ # Declaring the container as service,
+ # will link it to the others Platforms containers
+ # on creation.
+ is_service: yes
+
+provisioner:
+ name: ansible
+ options:
+ diff: True
+ v: True
+ playbooks:
+ create: ../resources/create.yml
+ destroy: ../resources/destroy.yml
+ prepare: ../resources/prepare.yml
+ lint:
+ name: ansible-lint
+ options:
+ # excludes "systemctl used in place of systemd module"
+ x: ["ANSIBLE0006"]
+
+lint:
+ name: yamllint
+
+verifier:
+ name: testinfra
+ options:
+ hosts: "pdns"
+ vvv: True
+ directory: ../resources/tests/all
+ additional_files_or_dirs:
+ # path relative to 'directory'
+ - ../repo-41/
+ - ../backend-sqlite/
+ - ../backend-mysql/
+ lint:
+ name: flake8
diff --git a/roles/powerdns.pdns/molecule/pdns-41/playbook.yml b/roles/powerdns.pdns/molecule/pdns-41/playbook.yml
new file mode 100644
index 0000000..93fd14f
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/pdns-41/playbook.yml
@@ -0,0 +1,9 @@
+---
+
+- hosts: pdns
+ vars_files:
+ - ../resources/vars/pdns-common.yml
+ - ../resources/vars/pdns-repo-41.yml
+ - ../resources/vars/pdns-backends.yml
+ roles:
+ - { role: pdns-ansible }
diff --git a/roles/powerdns.pdns/molecule/pdns-master/molecule.yml b/roles/powerdns.pdns/molecule/pdns-master/molecule.yml
new file mode 100644
index 0000000..86cff71
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/pdns-master/molecule.yml
@@ -0,0 +1,94 @@
+---
+
+scenario:
+ name: pdns-master
+
+driver:
+ name: docker
+
+dependency:
+ name: galaxy
+
+platforms:
+ - name: centos-6
+ image: centos:6
+ groups:
+ - pdns
+
+ - name: centos-7
+ image: centos:7
+ dockerfile_tpl: centos-systemd
+ groups:
+ - pdns
+
+ - name: ubuntu-1604
+ image: ubuntu:16.04
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ - name: ubuntu-1710
+ image: ubuntu:17.10
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ - name: ubuntu-1804
+ image: ubuntu:18.04
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ - name: debian-8
+ image: debian:8
+ groups:
+ - pdns
+
+ - name: debian-9
+ image: debian:9
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns
+
+ # In order to run the tests we need
+ # a MySQL container to be up & running
+ - name: mysql
+ image: mysql:5.7
+ env:
+ MYSQL_ROOT_PASSWORD: pdns
+ # Declaring the container as service,
+ # will link it to the others Platforms containers
+ # on creation.
+ is_service: yes
+
+provisioner:
+ name: ansible
+ options:
+ diff: True
+ v: True
+ playbooks:
+ create: ../resources/create.yml
+ destroy: ../resources/destroy.yml
+ prepare: ../resources/prepare.yml
+ lint:
+ name: ansible-lint
+ options:
+ # excludes "systemctl used in place of systemd module"
+ x: ["ANSIBLE0006"]
+
+lint:
+ name: yamllint
+
+verifier:
+ name: testinfra
+ options:
+ hosts: "pdns"
+ vvv: True
+ directory: ../resources/tests/all
+ additional_files_or_dirs:
+ # path relative to 'directory'
+ - ../repo-master/
+ - ../backend-sqlite/
+ - ../backend-mysql/
+ lint:
+ name: flake8
diff --git a/roles/powerdns.pdns/molecule/pdns-master/playbook.yml b/roles/powerdns.pdns/molecule/pdns-master/playbook.yml
new file mode 100644
index 0000000..6805304
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/pdns-master/playbook.yml
@@ -0,0 +1,9 @@
+---
+
+- hosts: pdns
+ vars_files:
+ - ../resources/vars/pdns-common.yml
+ - ../resources/vars/pdns-repo-master.yml
+ - ../resources/vars/pdns-backends.yml
+ roles:
+ - { role: pdns-ansible }
diff --git a/roles/powerdns.pdns/molecule/resources/Dockerfile.centos-systemd.j2 b/roles/powerdns.pdns/molecule/resources/Dockerfile.centos-systemd.j2
new file mode 100644
index 0000000..74c4fa0
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/Dockerfile.centos-systemd.j2
@@ -0,0 +1,26 @@
+# Molecule managed
+
+FROM {{ item.image }}
+
+ENV container docker
+
+# Configure systemd to run into the container (see https://hub.docker.com/_/centos/)
+RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
+rm -f /lib/systemd/system/multi-user.target.wants/*;\
+rm -f /etc/systemd/system/*.wants/*;\
+rm -f /lib/systemd/system/local-fs.target.wants/*; \
+rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
+rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
+rm -f /lib/systemd/system/basic.target.wants/*;\
+rm -f /lib/systemd/system/anaconda.target.wants/*;
+
+# Install sudo and disable requiretty
+RUN yum -y install sudo
+RUN /usr/bin/sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
+
+VOLUME [ "/sys/fs/cgroup" ]
+
+CMD ["/usr/sbin/init"]
+
+RUN if [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf net-tools bash && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl net-tools bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; fi
diff --git a/roles/powerdns.pdns/molecule/resources/Dockerfile.debian-systemd.j2 b/roles/powerdns.pdns/molecule/resources/Dockerfile.debian-systemd.j2
new file mode 100644
index 0000000..0c3845b
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/Dockerfile.debian-systemd.j2
@@ -0,0 +1,25 @@
+# Molecule managed
+
+FROM {{ item.image }}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y systemd && apt-get clean; fi
+RUN if [ ! -e /sbin/init ]; then ln -s /lib/systemd/systemd /sbin/init ; fi
+
+ENV container docker
+
+# Don't start the optional systemd services.
+RUN find /etc/systemd/system \
+ /lib/systemd/system \
+ -path '*.wants/*' \
+ -not -name '*journald*' \
+ -not -name '*systemd-tmpfiles*' \
+ -not -name '*systemd-user-sessions*' \
+ -exec rm \{} \;
+
+RUN systemctl set-default multi-user.target
+
+VOLUME [ "/sys/fs/cgroup" ]
+
+CMD ["/sbin/init"]
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash net-tools ca-certificates && apt-get clean; fi
diff --git a/roles/powerdns.pdns/molecule/resources/Dockerfile.default.j2 b/roles/powerdns.pdns/molecule/resources/Dockerfile.default.j2
new file mode 100644
index 0000000..c0847ae
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/Dockerfile.default.j2
@@ -0,0 +1,11 @@
+# Molecule managed
+
+FROM {{ item.image }}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates net-tools && apt-get clean; \
+ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf bash net-tools && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash net-tools && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
+ elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml net-tools && zypper clean -a; \
+ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi
+
+CMD ["sleep", "infinity"]
diff --git a/roles/powerdns.pdns/molecule/resources/create.yml b/roles/powerdns.pdns/molecule/resources/create.yml
new file mode 100644
index 0000000..8fadd37
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/create.yml
@@ -0,0 +1,63 @@
+---
+
+- name: Create
+ hosts: localhost
+ connection: local
+ gather_facts: False
+ vars_files:
+ - vars/molecule.yml
+ tasks:
+
+ - set_fact:
+ molecule_service_instances: "{{ molecule_yml.platforms | selectattr('is_service', 'defined') | selectattr('is_service') | list }}"
+ - set_fact:
+ molecule_platform_instances: "{{ molecule_yml.platforms | difference(molecule_service_instances) }}"
+
+ - name: Create Dockerfiles from image names
+ template:
+ src: "Dockerfile.{{ item.dockerfile_tpl | default('default') }}.j2"
+ dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}"
+ with_items: "{{ molecule_platform_instances }}"
+ register: platforms
+
+ - name: Discover local Docker images
+ docker_image_facts:
+ name: "molecule_pdns/{{ item.item.name }}"
+ with_items: "{{ platforms.results }}"
+ register: docker_images
+
+ - name: Build an Ansible compatible image
+ docker_image:
+ path: "{{ molecule_ephemeral_directory }}"
+ name: "molecule_pdns/{{ item.item.image }}"
+ dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
+ force: "{{ item.item.force | default(True) }}"
+ with_items: "{{ platforms.results }}"
+ when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0
+
+ - name: Create molecule instance(s)
+ docker_container:
+ name: "{{ item.name }}"
+ hostname: "{{ item.name }}"
+ image: "{{ item.image }}"
+ state: started
+ recreate: False
+ env: "{{ item.env | default(omit) }}"
+ privileged: "no"
+ volumes: "{{ item.volumes | default(omit) }}"
+ with_items: "{{ molecule_service_instances }}"
+
+ - name: Create the required Services instance(s)
+ docker_container:
+ name: "{{ item.name }}"
+ hostname: "{{ item.name }}"
+ image: "molecule_pdns/{{ item.image }}"
+ links: "{{ molecule_service_instances | map(attribute='name') | list }}"
+ command: "{{ item.command | default(omit) }}"
+ state: started
+ recreate: False
+ privileged: "yes"
+ volumes:
+ # Mount the cgroups fs to allow SystemD to run into the containers
+ - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
+ with_items: "{{ molecule_platform_instances }}"
diff --git a/roles/powerdns.pdns/molecule/resources/destroy.yml b/roles/powerdns.pdns/molecule/resources/destroy.yml
new file mode 100644
index 0000000..7f39803
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/destroy.yml
@@ -0,0 +1,15 @@
+---
+
+- name: Destroy the Molecule Test Resources
+ hosts: localhost
+ connection: local
+ gather_facts: False
+ vars_files:
+ - vars/molecule.yml
+ tasks:
+ - name: Destroy the target Platforms instance(s)
+ docker_container:
+ name: "{{ item.name }}"
+ state: absent
+ force_kill: "{{ item.force_kill | default(True) }}"
+ with_items: "{{ molecule_yml.platforms }}"
diff --git a/roles/powerdns.pdns/molecule/resources/prepare.yml b/roles/powerdns.pdns/molecule/resources/prepare.yml
new file mode 100644
index 0000000..2ca63d7
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/prepare.yml
@@ -0,0 +1,33 @@
+---
+
+- name: Prepare the Molecule Test Resources
+ hosts: pdns
+ tasks:
+ # Make sure the default MySQL and SQLite
+ # schemas are installed in /usr/share/doc/
+ - name: Disable the YUM 'nodocs' option
+ lineinfile:
+ line: tsflags=nodocs
+ dest: /etc/yum.conf
+ state: absent
+ when: ansible_pkg_mgr == 'yum'
+
+ - name: Disable the APT 'nodoc' option
+ lineinfile:
+ line: path-exclude=/usr/share/doc/*
+ dest: /etc/dpkg/dpkg.cfg.d/excludes
+ state: absent
+
+ # Install rsyslog to capture the PDNS log messages
+ # when the service is not managed by systemd
+ - block:
+ - name: Install rsyslog
+ package:
+ name: rsyslog
+ state: present
+
+ - name: Start rsyslog
+ service:
+ name: rsyslog
+ state: started
+ when: ansible_service_mgr != 'systemd'
diff --git a/roles/powerdns.pdns/molecule/resources/tests/all/test_common.py b/roles/powerdns.pdns/molecule/resources/tests/all/test_common.py
new file mode 100644
index 0000000..bf1bb5f
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/tests/all/test_common.py
@@ -0,0 +1,47 @@
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+def test_distribution(host):
+ assert host.system_info.distribution.lower() in debian_os + rhel_os
+
+
+def test_repo_pinning_file(host):
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/preferences.d/pdns')
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+ f.contains('Package: pdns-*')
+ f.contains('Pin: origin repo.powerdns.com')
+ f.contains('Pin-Priority: 600')
+
+
+def test_package(host):
+ p = None
+ if host.system_info.distribution.lower() in debian_os:
+ p = host.package('pdns-server')
+ if host.system_info.distribution.lower() in rhel_os:
+ p = host.package('pdns')
+
+ assert p.is_installed
+
+
+def test_service(host):
+ # Using Ansible to mitigate some issues with the service test on debian-8
+ s = host.ansible('service', 'name=pdns state=started enabled=yes')
+
+ assert s["changed"] is False
+
+
+def systemd_override(host):
+ smgr = host.ansible("setup")["ansible_facts"]["ansible_service_mgr"]
+ if smgr == 'systemd':
+ fname = '/etc/systemd/system/pdns.service.d/override.conf'
+ f = host.file(fname)
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+ assert 'LimitCORE=infinity' in f.content
diff --git a/roles/powerdns.pdns/molecule/resources/tests/backend-mysql/test_backend_mysql.py b/roles/powerdns.pdns/molecule/resources/tests/backend-mysql/test_backend_mysql.py
new file mode 100644
index 0000000..d1412fb
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/tests/backend-mysql/test_backend_mysql.py
@@ -0,0 +1,43 @@
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+def test_package(host):
+ p = host.package('pdns-backend-mysql')
+
+ assert p.is_installed
+
+
+def test_config(host):
+ with host.sudo():
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/powerdns/pdns.conf')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/pdns/pdns.conf')
+
+ dbname = host.check_output('hostname -s').replace('.', '_')
+
+ assert f.exists
+ assert 'launch+=gmysql' in f.content
+ assert 'gmysql-host=mysql' in f.content
+ assert 'gmysql-password=pdns' in f.content
+ assert 'gmysql-dbname=' + dbname in f.content
+ assert 'gmysql-user=pdns' in f.content
+
+
+def test_database_tables(host):
+ dbname = host.check_output('hostname -s').replace('.', '_')
+
+ cmd = host.run("mysql --user=\"pdns\" --password=\"pdns\" --host=\"mysql\" " +
+ "--batch --skip-column-names " +
+ "--execute=\"SELECT DISTINCT table_name FROM information_schema.columns WHERE table_schema = '%s'\"" % dbname)
+
+ assert 'domains' in cmd.stdout
+ assert 'records' in cmd.stdout
+ assert 'supermasters' in cmd.stdout
+ assert 'comments' in cmd.stdout
+ assert 'domainmetadata' in cmd.stdout
+ assert 'cryptokeys' in cmd.stdout
+ assert 'tsigkeys' in cmd.stdout
diff --git a/roles/powerdns.pdns/molecule/resources/tests/backend-sqlite/test_backend_sqlite.py b/roles/powerdns.pdns/molecule/resources/tests/backend-sqlite/test_backend_sqlite.py
new file mode 100644
index 0000000..459a5df
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/tests/backend-sqlite/test_backend_sqlite.py
@@ -0,0 +1,23 @@
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+def test_package(host):
+ p = None
+ if host.system_info.distribution.lower() in debian_os:
+ p = host.package('pdns-backend-sqlite3')
+ if host.system_info.distribution.lower() in rhel_os:
+ p = host.package('pdns-backend-sqlite')
+
+ assert p.is_installed
+
+
+def test_database_exists(host):
+ f = host.file('/var/lib/powerdns/pdns.db')
+
+ assert f.exists
+ assert f.user == 'pdns'
+ assert f.group == 'pdns'
+ assert f.mode == 416
+ assert f.size > 10000
diff --git a/roles/powerdns.pdns/molecule/resources/tests/repo-41/test_repo_41.py b/roles/powerdns.pdns/molecule/resources/tests/repo-41/test_repo_41.py
new file mode 100644
index 0000000..4cdde3c
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/tests/repo-41/test_repo_41.py
@@ -0,0 +1,32 @@
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+def test_repo_file(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-auth-41.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-auth-41.repo')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+
+
+def test_pdns_repo(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-auth-41.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-auth-41.repo')
+
+ assert f.exists
+ assert f.contains('auth-41')
+
+
+def test_pdns_version(host):
+ cmd = host.run('/usr/sbin/pdns_server --version')
+
+ assert 'PowerDNS Authoritative Server 4.1.' in cmd.stderr
diff --git a/roles/powerdns.pdns/molecule/resources/tests/repo-master/test_repo_master.py b/roles/powerdns.pdns/molecule/resources/tests/repo-master/test_repo_master.py
new file mode 100644
index 0000000..715ba68
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/tests/repo-master/test_repo_master.py
@@ -0,0 +1,32 @@
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+def test_repo_file(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-auth-master.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-auth-master.repo')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+
+
+def test_pdns_repo(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-auth-master.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-auth-master.repo')
+
+ assert f.exists
+ assert f.contains('auth-master')
+
+
+def test_pdns_version(host):
+ cmd = host.run('/usr/sbin/pdns_server --version')
+
+ assert 'PowerDNS Authoritative Server 0.0.' in cmd.stderr
diff --git a/roles/powerdns.pdns/molecule/resources/vars/molecule.yml b/roles/powerdns.pdns/molecule/resources/vars/molecule.yml
new file mode 100644
index 0000000..298c000
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/vars/molecule.yml
@@ -0,0 +1,6 @@
+---
+
+molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
+molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
+molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
+molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"
diff --git a/roles/powerdns.pdns/molecule/resources/vars/pdns-backends.yml b/roles/powerdns.pdns/molecule/resources/vars/pdns-backends.yml
new file mode 100644
index 0000000..4d6b11a
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/vars/pdns-backends.yml
@@ -0,0 +1,26 @@
+---
+
+##
+# PowerDNS Backends
+##
+
+pdns_backends:
+ gsqlite3:
+ database: /var/lib/powerdns/pdns.db
+ dnssec: yes
+ gmysql:
+ host: "mysql" # This is relying on Docker's service discovery
+ dbname: "{{ ansible_hostname | replace('.', '_') }}" # Each Platform will have its MySQL DB
+ user: pdns
+ password: pdns
+
+pdns_sqlite_databases_locations:
+ - '/var/lib/powerdns/pdns.db'
+
+pdns_mysql_databases_credentials:
+ gmysql:
+ priv_user: root
+ priv_password: "{{ ansible_env.MYSQL_ENV_MYSQL_ROOT_PASSWORD }}" # The MySQL root password
+ priv_host: # is injected by Docker into the env
+ - '%'
+ - 'localhost'
diff --git a/roles/powerdns.pdns/molecule/resources/vars/pdns-common.yml b/roles/powerdns.pdns/molecule/resources/vars/pdns-common.yml
new file mode 100644
index 0000000..69edda2
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/vars/pdns-common.yml
@@ -0,0 +1,26 @@
+---
+
+##
+# PowerDNS Configuration
+##
+
+pdns_config:
+
+ # Turns on master operations
+ master: true
+
+ # Listen Address
+ local-address: "127.0.0.1"
+ local-port: "53"
+
+ # API Configuration
+ api: yes
+ api-key: "powerdns"
+
+ # Embedded webserver
+ webserver: yes
+ webserver-address: "0.0.0.0"
+ webserver-port: "8001"
+
+pdns_service_overrides:
+ LimitCORE: infinity
diff --git a/roles/powerdns.pdns/molecule/resources/vars/pdns-repo-41.yml b/roles/powerdns.pdns/molecule/resources/vars/pdns-repo-41.yml
new file mode 100644
index 0000000..2059547
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/vars/pdns-repo-41.yml
@@ -0,0 +1,7 @@
+---
+
+##
+# PowerDNS 4.1.x Repository
+##
+
+pdns_install_repo: "{{ pdns_auth_powerdns_repo_41 }}"
diff --git a/roles/powerdns.pdns/molecule/resources/vars/pdns-repo-master.yml b/roles/powerdns.pdns/molecule/resources/vars/pdns-repo-master.yml
new file mode 100644
index 0000000..6e3395e
--- /dev/null
+++ b/roles/powerdns.pdns/molecule/resources/vars/pdns-repo-master.yml
@@ -0,0 +1,7 @@
+---
+
+##
+# PowerDNS Master Repository
+##
+
+pdns_install_repo: "{{ pdns_auth_powerdns_repo_master }}"
diff --git a/roles/powerdns.pdns/tasks/configure.yml b/roles/powerdns.pdns/tasks/configure.yml
new file mode 100644
index 0000000..65de800
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/configure.yml
@@ -0,0 +1,110 @@
+---
+
+- block:
+
+ - name: Ensure the override directory exists (systemd)
+ file:
+ name: "/etc/systemd/system/{{ pdns_service_name }}.service.d"
+ state: directory
+ owner: root
+ group: root
+
+ - name: Override the PowerDNS Authoritative Server unit (systemd)
+ template:
+ src: "override-service.systemd.conf.j2"
+ dest: "/etc/systemd/system/{{ pdns_service_name }}.service.d/override.conf"
+ owner: root
+ group: root
+ notify: reload systemd and restart PowerDNS
+
+ when: pdns_service_overrides != {}
+ and ansible_service_mgr == "systemd"
+
+- name: Ensure that the PowerDNS Authoritative Server configuration directory exists
+ file:
+ name: "{{ pdns_config_dir }}"
+ state: directory
+ owner: "root"
+ group: "root"
+ mode: 0750
+
+- name: Generate the PowerDNS Authoritative Server configuration
+ template:
+ src: pdns.conf.j2
+ dest: "{{ pdns_config_dir }}/{{ pdns_config_file }}"
+ owner: "root"
+ group: "root"
+ mode: 0640
+ notify: restart PowerDNS
+
+- name: Ensure that the PowerDNS Authoritative Server 'include-dir' directory exists
+ file:
+ name: "{{ pdns_config['include-dir'] }}"
+ state: directory
+ owner: "root"
+ group: "root"
+ mode: 0750
+ when: "pdns_config['include-dir'] is defined"
+
+- name: Enable Syslog logging for PowerDns
+ lineinfile:
+ path: /usr/lib/systemd/system/pdns.service
+ regexp: 'disable-syslog'
+ line: "ExecStart=/usr/sbin/pdns_server --guardian=no --daemon=no --log-timestamp=no --write-pid=no"
+ become: true
+ become_method: sudo
+ notify: reload systemd and restart PowerDNS
+
+- name: Configure syslog log rotation
+ template:
+ src: syslogrotate.conf.j2
+ dest: "/etc/logrotate.d/syslog"
+ become: true
+ become_method: sudo
+
+- block:
+ - name: Ensure that the bind backend dir exists
+ file:
+ name: "{{ pdns_bind_backend_dir }}"
+ state: directory
+ owner: "{{ pdns_user }}"
+ group: "{{ pdns_group }}"
+ mode: 0750
+ - name: Ensure that the bind backend config file exists
+ template:
+ src: bind.conf.j2
+ dest: "{{ pdns_bind_backend_config }}"
+ owner: "{{ pdns_user }}"
+ group: "{{ pdns_group }}"
+ mode: 0640
+ notify: restart PowerDNS
+ - name:
+ copy:
+ src: "{{ domain | replace('/','-') }}.zone"
+ dest: "{{ pdns_bind_backend_dir }}/{{ domain | replace('/','-') }}.zone"
+ owner: "{{ pdns_user }}"
+ group: "{{ pdns_group }}"
+ mode: 0444
+ loop: "{{ managed_domains | default([], true) }}"
+ loop_control:
+ loop_var: domain
+ notify: restart PowerDNS
+ when:
+ - managed_domains is defined
+ - name: Ensure that the dnssec bind db exists
+ shell:
+ cmd: "pdnsutil create-bind-db {{ pdns_backends['bind']['dnssec-db'] }}"
+ creates: "{{ pdns_backends['bind']['dnssec-db'] }}"
+ when:
+ - (pdns_backends['bind']['dnssec-db'] | default("", true)) != ""
+ - name: Set ownership of dnssec db
+ file:
+ name: "{{ pdns_backends['bind']['dnssec-db'] }}"
+ owner: "{{ pdns_user }}"
+ group: "{{ pdns_group }}"
+ mode: 0640
+ when:
+ - (pdns_backends['bind']['dnssec-db'] | default("", true)) != ""
+ when:
+ - "pdns_backends['bind'] is defined"
+
diff --git a/roles/powerdns.pdns/tasks/database-mysql.yml b/roles/powerdns.pdns/tasks/database-mysql.yml
new file mode 100644
index 0000000..e28782d
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/database-mysql.yml
@@ -0,0 +1,89 @@
+---
+
+- name: Install the MySQL dependencies on RedHat
+ package:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - mysql
+ - MySQL-python
+ when: ansible_facts.os_family == 'RedHat'
+
+- name: Install the MySQL dependencies on Debian
+ package:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - mysql-client
+ - python-mysqldb
+ when: ansible_facts.os_family == 'Debian'
+
+- name: Create the PowerDNS Authoritative Server MySQL databases
+ mysql_db:
+ login_user: "{{ item['value']['priv_user'] }}"
+ login_password: "{{ item['value']['priv_password'] }}"
+ login_host: "{{ item['value']['host'] }}"
+ login_port: "{{ item['value']['port'] | default('3306') }}"
+ name: "{{ item['value']['dbname'] }}"
+ state: present
+ when: "item.key.split(':')[0] == 'gmysql'"
+ with_dict: "{{ pdns_backends | combine(pdns_mysql_databases_credentials, recursive=True) }}"
+
+- name: Grant the PowerDNS Authoritative Server access to the MySQL databases
+ mysql_user:
+ login_user: "{{ item[0]['priv_user'] }}"
+ login_password: "{{ item[0]['priv_password'] }}"
+ login_host: "{{ item[0]['host'] }}"
+ login_port: "{{ item[0]['port'] | default('3306') }}"
+ name: "{{ item[0]['user'] }}"
+ password: "{{ item[0]['password'] }}"
+ host: "{{ item[1] }}"
+ priv: "{{ item[0]['dbname'] }}.*:ALL"
+ append_privs: yes
+ state: present
+ with_subelements:
+ - "{{ pdns_backends | combine(pdns_mysql_databases_credentials, recursive=True) }}"
+ - priv_host
+ - skip_missing: yes
+
+- name: Check if the PowerDNS Authoritative Server MySQL databases are empty
+ command: >
+ mysql --user="{{ item['value']['user'] }}" --password="{{ item['value']['password'] }}"
+ --host="{{ item['value']['host'] }}" --port "{{ item['value']['port'] | default('3306') }}" --batch --skip-column-names
+ --execute="SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '{{ item['value']['dbname'] }}'"
+ when: item.key.split(':')[0] == 'gmysql'
+ with_dict: "{{ pdns_backends }}"
+ register: _pdns_check_mysql_db
+ changed_when: False
+
+- name: Define the PowerDNS Authoritative Server database MySQL schema file path on RedHat < 7
+ set_fact:
+ _pdns_mysql_schema_file: "/usr/share/doc/pdns/schema.mysql.sql"
+ when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version | int < 7
+
+- name: Define the PowerDNS Authoritative Server database MySQL schema file path on RedHat >= 7
+ set_fact:
+ _pdns_mysql_schema_file: "/usr/share/doc/pdns-backend-mysql-{{ _pdns_running_version | regex_replace('-rc[\\d]*$', '') }}/schema.mysql.sql"
+ when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version | int >= 7
+
+- name: Define the PowerDNS Authoritative Server database MySQL schema file path on Debian
+ set_fact:
+ _pdns_mysql_schema_file: "/usr/share/dbconfig-common/data/pdns-backend-mysql/install/mysql"
+ when: ansible_facts.os_family == 'Debian' and pdns_install_repo == ''
+
+- name: Define the PowerDNS Authoritative Server database MySQL schema file path on Debian
+ set_fact:
+ _pdns_mysql_schema_file: "/usr/share/doc/pdns-backend-mysql/schema.mysql.sql"
+ when: ansible_facts.os_family == 'Debian' and pdns_install_repo != ''
+
+- name: Import the PowerDNS Authoritative Server MySQL schema
+ mysql_db:
+ login_user: "{{ item['item']['value']['user'] }}"
+ login_password: "{{ item['item']['value']['password'] }}"
+ login_host: "{{ item['item']['value']['host'] }}"
+ login_port: "{{ item['item']['port'] | default('3306') }}"
+ name: "{{ item.item['value']['dbname'] }}"
+ state: import
+ target: "{{ _pdns_mysql_schema_file }}"
+ when: "item['item']['key'].split(':')[0] == 'gmysql' and item['stdout'] == '0'"
+ with_items: "{{ _pdns_check_mysql_db['results'] }}"
diff --git a/roles/powerdns.pdns/tasks/database-sqlite3.yml b/roles/powerdns.pdns/tasks/database-sqlite3.yml
new file mode 100644
index 0000000..ffcdfe5
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/database-sqlite3.yml
@@ -0,0 +1,40 @@
+---
+
+- name: Ensure that the directories containing the PowerDNS Authoritative Server SQLite databases exist
+ file:
+ name: "{{ item | dirname }}"
+ owner: "{{ pdns_user }}"
+ group: "{{ pdns_group }}"
+ state: directory
+ mode: 0750
+ with_items: "{{ pdns_sqlite_databases_locations }}"
+
+- name: Create the PowerDNS Authoritative Server SQLite databases on RedHat < 7
+ shell: "sqlite3 {{ item }} < /usr/share/doc/pdns/schema.sqlite3.sql"
+ args:
+ creates: "{{ item }}"
+ with_items: "{{ pdns_sqlite_databases_locations }}"
+ when: ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version | int < 7
+
+- name: Create the PowerDNS Authoritative Server SQLite databases on RedHat >= 7
+ shell: "sqlite3 {{ item }} < /usr/share/doc/pdns-backend-sqlite-{{ _pdns_running_version | regex_replace('-rc[\\d]*$', '') }}/schema.sqlite3.sql"
+ args:
+ creates: "{{ item }}"
+ with_items: "{{ pdns_sqlite_databases_locations }}"
+ when: ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version | int >= 7
+
+- name: Create the PowerDNS Authoritative Server SQLite databases on Debian
+ shell: "sqlite3 {{ item }} < /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql"
+ args:
+ creates: "{{ item }}"
+ with_items: "{{ pdns_sqlite_databases_locations }}"
+ when: ansible_facts.os_family == "Debian"
+
+- name: Check the PowerDNS Authoritative Server SQLite databases permissions
+ file:
+ name: "{{ item }}"
+ owner: "{{ pdns_user }}"
+ group: "{{ pdns_group }}"
+ mode: 0640
+ state: file
+ with_items: "{{ pdns_sqlite_databases_locations }}"
diff --git a/roles/powerdns.pdns/tasks/inspect.yml b/roles/powerdns.pdns/tasks/inspect.yml
new file mode 100644
index 0000000..cd5b63f
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/inspect.yml
@@ -0,0 +1,11 @@
+---
+
+- name: Obtain the version of the running PowerDNS Authoritative Server
+ shell: "pdns_server --version 2>&1 | awk '/PowerDNS Authoritative/{print $7}'"
+ register: _pdns_version
+ check_mode: no
+ changed_when: False
+
+- name: Export the running PowerDNS Authoritative Server version to a variable
+ set_fact:
+ _pdns_running_version: "{{ _pdns_version['stdout'] }}"
diff --git a/roles/powerdns.pdns/tasks/install.yml b/roles/powerdns.pdns/tasks/install.yml
new file mode 100644
index 0000000..c64bb2c
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/install.yml
@@ -0,0 +1,33 @@
+---
+
+- block:
+
+ - name: Prefix the version with the correct separator on RedHat
+ set_fact:
+ _pdns_package_version: "-{{ pdns_package_version }}"
+ when: ansible_os_family == 'RedHat'
+
+ - name: Prefix the version with the correct separator on Debian
+ set_fact:
+ _pdns_package_version: "={{ pdns_package_version }}"
+ when: ansible_os_family == 'Debian'
+
+ when: pdns_package_version != ''
+
+- name: Install the PowerDNS Authoritative Server
+ package:
+ name: "{{ pdns_package_name }}{{ _pdns_package_version | default('') }}"
+ state: present
+
+- name: Install the PowerDNS Authoritative Server debug symbols
+ package:
+ name: "{{ pdns_debug_symbols_package_name }}{{ _pdns_package_version | default('') }}"
+ state: present
+ when: pdns_install_debug_symbols_package
+
+- name: Install the PowerDNS Authoritative Server backends
+ package:
+ name: "{{ pdns_backends_packages[item.key.split(':')[0]] }}{{ _pdns_package_version | default('') }}"
+ state: present
+ when: pdns_backends_packages[item.key.split(':')[0]] is defined
+ with_dict: "{{ pdns_backends }}"
diff --git a/roles/powerdns.pdns/tasks/main.yml b/roles/powerdns.pdns/tasks/main.yml
new file mode 100644
index 0000000..65bed52
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/main.yml
@@ -0,0 +1,54 @@
+---
+
+- name: Include OS-specific variables
+ include_vars: "{{ ansible_facts.os_family }}.yml"
+ tags:
+ - always
+
+- include: "repo-{{ ansible_facts.os_family }}.yml"
+ when: pdns_install_repo != ""
+ tags:
+ - install
+ - repository
+
+- include: install.yml
+ tags:
+ - install
+
+- include: inspect.yml
+ tags:
+ - db
+ - mysql
+ - sqlite
+ - config
+
+- include: database-mysql.yml
+ when: "pdns_mysql_databases_credentials | length > 0"
+ tags:
+ - db
+ - mysql
+
+- include: database-sqlite3.yml
+ when: "pdns_sqlite_databases_locations | length > 0"
+ tags:
+ - db
+ - sqlite
+
+- include: configure.yml
+ tags:
+ - config
+
+- name: Start and enable the PowerDNS Authoritative Server service
+ service:
+ name: "{{ pdns_service_name }}"
+ state: started
+ enabled: true
+ tags:
+ - service
+
+- name: Force handlers flush
+ meta: flush_handlers
+ when: pdns_flush_handlers
+ tags:
+ - config
+ - service
diff --git a/roles/powerdns.pdns/tasks/repo-Debian.yml b/roles/powerdns.pdns/tasks/repo-Debian.yml
new file mode 100644
index 0000000..d85c29d
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/repo-Debian.yml
@@ -0,0 +1,33 @@
+---
+
+- name: Install gnupg
+ package:
+ name: gnupg
+ state: present
+
+- name: Import the PowerDNS Authoritative Server APT Repository key
+ apt_key:
+ url: "{{ pdns_install_repo['gpg_key'] }}"
+ id: "{{ pdns_install_repo['gpg_key_id'] | default('') }}"
+ state: present
+ register: _pdns_apt_key
+
+- name: Add the PowerDNS Authoritative Server APT Repository
+ apt_repository:
+ filename: "{{ pdns_install_repo['name'] }}"
+ repo: "{{ pdns_install_repo['apt_repo'] }}"
+ state: present
+ register: _pdns_apt_repo
+
+- name: Update the APT cache
+ apt:
+ update_cache: yes
+ when: "_pdns_apt_key.changed or _pdns_apt_repo.changed"
+
+- name: Pin the PowerDNS Authoritative Server APT Repository
+ template:
+ src: pdns.pin.j2
+ dest: /etc/apt/preferences.d/pdns
+ owner: root
+ group: root
+ mode: 0644
diff --git a/roles/powerdns.pdns/tasks/repo-RedHat.yml b/roles/powerdns.pdns/tasks/repo-RedHat.yml
new file mode 100644
index 0000000..8dbd6be
--- /dev/null
+++ b/roles/powerdns.pdns/tasks/repo-RedHat.yml
@@ -0,0 +1,47 @@
+---
+
+- block:
+
+ - name: Install epel-release on CentOS
+ yum:
+ name: epel-release
+ state: latest
+ update_cache: true
+ when: ansible_facts.distribution in [ 'CentOS' ]
+
+ - name: Install epel-release on RHEL/OracleLinux
+ yum:
+ name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm"
+ state: present
+ when: ansible_facts.distribution in [ 'RedHat', 'OracleLinux' ]
+
+ when: pdns_install_epel
+
+- name: Install yum-plugin-priorities
+ package:
+ name: yum-plugin-priorities
+ state: present
+ when: ansible_facts.distribution in [ 'CentOS' ]
+
+- name: Add the PowerDNS Authoritative Server YUM Repository
+ yum_repository:
+ name: "{{ pdns_install_repo['name'] }}"
+ file: "{{ pdns_install_repo['name'] }}"
+ description: PowerDNS Authoritative Server
+ baseurl: "{{ pdns_install_repo['yum_repo_baseurl'] }}"
+ gpgkey: "{{ pdns_install_repo['gpg_key'] }}"
+ gpgcheck: yes
+ priority: 90
+ state: present
+
+- name: Add the PowerDNS Authoritative Server debug symbols YUM Repository
+ yum_repository:
+ name: "{{ pdns_install_repo['name'] }}-debuginfo"
+ file: "{{ pdns_install_repo['name'] }}"
+ description: PowerDNS Authoritative Server - debug symbols
+ baseurl: "{{ pdns_install_repo['yum_debug_symbols_repo_baseurl'] }}"
+ gpgkey: "{{ pdns_install_repo['gpg_key'] }}"
+ gpgcheck: yes
+ priority: 90
+ state: present
+ when: pdns_install_debug_symbols_package
diff --git a/roles/powerdns.pdns/templates/bind.conf.j2 b/roles/powerdns.pdns/templates/bind.conf.j2
new file mode 100644
index 0000000..6148310
--- /dev/null
+++ b/roles/powerdns.pdns/templates/bind.conf.j2
@@ -0,0 +1,12 @@
+# Ansible managed file
+options {
+ directory "{{ pdns_bind_backend_dir }}";
+};
+{% if managed_domains is defined %}
+{% for domain in managed_domains | default([], true) %}
+zone "{{ domain }}" IN {
+ type master;
+ file "{{ pdns_bind_backend_dir }}/{{ domain | replace('/','-') }}.zone";
+};
+{% endfor %}
+{% endif %}
diff --git a/roles/powerdns.pdns/templates/override-service.systemd.conf.j2 b/roles/powerdns.pdns/templates/override-service.systemd.conf.j2
new file mode 100644
index 0000000..e9b486c
--- /dev/null
+++ b/roles/powerdns.pdns/templates/override-service.systemd.conf.j2
@@ -0,0 +1,4 @@
+[Service]
+{% for k, v in pdns_service_overrides.items() %}
+{{ k }}={{ v }}
+{% endfor %}
diff --git a/roles/powerdns.pdns/templates/pdns.conf.j2 b/roles/powerdns.pdns/templates/pdns.conf.j2
new file mode 100644
index 0000000..95a4399
--- /dev/null
+++ b/roles/powerdns.pdns/templates/pdns.conf.j2
@@ -0,0 +1,38 @@
+config-dir={{ pdns_config_dir }}
+setuid={{ pdns_user }}
+setgid={{ pdns_group }}
+{% for config_item, value in pdns_config.items() | sort() %}
+{% if config_item not in ["config-dir", "launch", "setuid", "setgid"] %}
+{% if value == True %}
+{{ config_item }}=yes
+{% elif value == False %}
+{{ config_item }}=no
+{% elif value is string %}
+{{ config_item }}={{ value | string }}
+{% elif value is sequence %}
+{{ config_item }}={{ value | join(',') }}
+{% else %}
+{{ config_item }}={{ value | string }}
+{% endif %}
+{% endif %}
+{% endfor %}
+
+launch=
+
+{% for backend in pdns_backends | sort() -%}
+launch+={{ backend }}
+{% set backend_string = backend | replace(':', '-') %}
+{% for backend_item, value in pdns_backends[backend].items() | sort() -%}
+{% if value == True %}
+{{ backend_string }}-{{ backend_item }}=yes
+{% elif value == False %}
+{{ backend_string }}-{{ backend_item }}=no
+{% elif value == None %}
+{{ backend_string }}-{{ backend_item }}=
+{% else %}
+{{ backend_string }}-{{ backend_item }}={{ value | string }}
+{% endif %}
+{% endfor %}
+
+{% endfor -%}
+
diff --git a/roles/powerdns.pdns/templates/pdns.pin.j2 b/roles/powerdns.pdns/templates/pdns.pin.j2
new file mode 100644
index 0000000..322cba2
--- /dev/null
+++ b/roles/powerdns.pdns/templates/pdns.pin.j2
@@ -0,0 +1,3 @@
+Package: pdns-*
+Pin: origin {{ pdns_install_repo['apt_repo_origin'] }}
+Pin-Priority: 600
diff --git a/roles/powerdns.pdns/templates/syslogrotate.conf.j2 b/roles/powerdns.pdns/templates/syslogrotate.conf.j2
new file mode 100644
index 0000000..d796fbd
--- /dev/null
+++ b/roles/powerdns.pdns/templates/syslogrotate.conf.j2
@@ -0,0 +1,24 @@
+/var/log/messages
+{
+ maxsize 1G
+ create 600 root root
+ rotate 8
+ daily
+ compress
+ missingok
+ sharedscripts
+ postrotate
+ /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
+ endscript
+}
+/var/log/cron
+/var/log/maillog
+/var/log/secure
+/var/log/spooler
+{
+ missingok
+ sharedscripts
+ postrotate
+ /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
+ endscript
+}
\ No newline at end of file
diff --git a/roles/powerdns.pdns/test-requirements.txt b/roles/powerdns.pdns/test-requirements.txt
new file mode 100644
index 0000000..5aad8de
--- /dev/null
+++ b/roles/powerdns.pdns/test-requirements.txt
@@ -0,0 +1,2 @@
+molecule==2.14.0
+docker-py==1.10.6
diff --git a/roles/powerdns.pdns/tox.ini b/roles/powerdns.pdns/tox.ini
new file mode 100644
index 0000000..2688207
--- /dev/null
+++ b/roles/powerdns.pdns/tox.ini
@@ -0,0 +1,22 @@
+[tox]
+minversion = 1.8
+envlist = py{27}-ansible{22,23,24,25}
+skipsdist = true
+
+[travis:env]
+ANSIBLE=
+ 2.2: ansible22
+ 2.3: ansible23
+ 2.4: ansible24
+ 2.5: ansible25
+
+[testenv]
+passenv = *
+deps =
+ -rtest-requirements.txt
+ ansible22: ansible<2.3
+ ansible23: ansible<2.4
+ ansible24: ansible<2.5
+ ansible25: ansible<2.6
+commands =
+ {posargs:molecule test --all --destroy always}
diff --git a/roles/powerdns.pdns/vars/Debian.yml b/roles/powerdns.pdns/vars/Debian.yml
new file mode 100644
index 0000000..a1a8825
--- /dev/null
+++ b/roles/powerdns.pdns/vars/Debian.yml
@@ -0,0 +1,25 @@
+---
+
+# The name of the PowerDNS Authoritative Server package
+default_pdns_package_name: "pdns-server"
+
+# The name of the PowerDNS Authoritative Server debug package
+default_pdns_debug_symbols_package_name: "pdns-server-dbg"
+
+# List of PowerDNS Authoritative Server Backends packages on Debian
+default_pdns_backends_packages:
+ geo: pdns-backend-geo
+ geoip: pdns-backend-geoip
+ gmysql: pdns-backend-mysql
+ gpgsql: pdns-backend-pgsql
+ gsqlite3: pdns-backend-sqlite3
+ ldap: pdns-backend-ldap
+ lmdb: pdns-backend-lmdb
+ lua: pdns-backend-lua
+ mydns: pdns-backend-mydns
+ pipe: pdns-backend-pipe
+ remote: pdns-backend-remote
+ tinydns: pdns-backend-tinydns
+
+# The directory where the PowerDNS Authoritative Server configuration is located
+default_pdns_config_dir: "/etc/powerdns"
diff --git a/roles/powerdns.pdns/vars/RedHat.yml b/roles/powerdns.pdns/vars/RedHat.yml
new file mode 100644
index 0000000..5ebaf5b
--- /dev/null
+++ b/roles/powerdns.pdns/vars/RedHat.yml
@@ -0,0 +1,25 @@
+---
+
+# The name of the PowerDNS Authoritative Server package
+default_pdns_package_name: "pdns"
+
+# The name of the PowerDNS Authoritative Server debug package
+default_pdns_debug_symbols_package_name: "pdns-debuginfo"
+
+# List of PowerDNS Authoritative Server backends packages on RedHat
+default_pdns_backends_packages:
+ geo: pdns-backend-geo
+ geoip: pdns-backend-geoip
+ gmysql: pdns-backend-mysql
+ gpgsql: pdns-backend-postgresql
+ gsqlite3: pdns-backend-sqlite
+ ldap: pdns-backend-ldap
+ lmdb: pdns-backend-lmdb
+ lua: pdns-backend-lua
+ mydns: pdns-backend-mydns
+ pipe: pdns-backend-pipe
+ remote: pdns-backend-remote
+ tinydns: pdns-backend-tinydns
+
+# The directory where the PowerDNS Authoritative Server configuration is located
+default_pdns_config_dir: "/etc/pdns"
diff --git a/roles/powerdns.pdns/vars/main.yml b/roles/powerdns.pdns/vars/main.yml
new file mode 100644
index 0000000..3690487
--- /dev/null
+++ b/roles/powerdns.pdns/vars/main.yml
@@ -0,0 +1,28 @@
+---
+
+pdns_auth_powerdns_repo_master:
+ apt_repo_origin: "repo.powerdns.com"
+ apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release | lower }}-auth-master main"
+ gpg_key: "http://repo.powerdns.com/CBC8B383-pub.asc"
+ gpg_key_id: "D47975F8DAE32700A563E64FFF389421CBC8B383"
+ yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/auth-master"
+ yum_debug_symbols_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/auth-master/debug"
+ name: "powerdns-auth-master"
+
+pdns_auth_powerdns_repo_40:
+ apt_repo_origin: "repo.powerdns.com"
+ apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release | lower }}-auth-40 main"
+ gpg_key: "http://repo.powerdns.com/FD380FBB-pub.asc"
+ gpg_key_id: "9FAAA5577E8FCF62093D036C1B0C6205FD380FBB"
+ yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/auth-40"
+ yum_debug_symbols_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/auth-40/debug"
+ name: "powerdns-auth-40"
+
+pdns_auth_powerdns_repo_41:
+ apt_repo_origin: "repo.powerdns.com"
+ apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release | lower }}-auth-41 main"
+ gpg_key: "http://repo.powerdns.com/FD380FBB-pub.asc"
+ gpg_key_id: "9FAAA5577E8FCF62093D036C1B0C6205FD380FBB"
+ yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/auth-41"
+ yum_debug_symbols_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/auth-41/debug"
+ name: "powerdns-auth-41"
diff --git a/roles/powerdns.pdns_recursor/.travis.yml b/roles/powerdns.pdns_recursor/.travis.yml
new file mode 100644
index 0000000..42f1e2e
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/.travis.yml
@@ -0,0 +1,29 @@
+---
+
+language: python
+python: 2.7
+
+sudo: required
+
+# Enable the docker service
+services:
+ - docker
+
+# Parallel testing of the supported
+# Ansible versions
+env:
+ matrix:
+ - ANSIBLE=2.5
+ - ANSIBLE=2.6
+ - ANSIBLE=2.7
+
+# Install tox
+install:
+ - pip install tox-travis
+
+# Test the current PowerDNS Recursor stable release
+script:
+ - tox -- molecule test -s pdns-rec-41
+
+notifications:
+ webhooks: https://galaxy.ansible.com/api/v1/notifications/
diff --git a/roles/powerdns.pdns_recursor/.yamllint b/roles/powerdns.pdns_recursor/.yamllint
new file mode 100644
index 0000000..4267219
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/.yamllint
@@ -0,0 +1,16 @@
+extends: default
+
+rules:
+
+ # Disable line-length and truthy values reporting
+ line-length: disable
+ truthy: disable
+
+ # Max 1 space to separate the elements in brakets
+ braces:
+ max-spaces-inside: 1
+
+ # Max 1 space in empty brackets
+ brackets:
+ min-spaces-inside-empty: 0
+ max-spaces-inside-empty: 1
diff --git a/roles/powerdns.pdns_recursor/CHANGELOG.md b/roles/powerdns.pdns_recursor/CHANGELOG.md
new file mode 100644
index 0000000..0d35055
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/CHANGELOG.md
@@ -0,0 +1,64 @@
+## v1.2.1 (2019-02-18)
+
+IMPROVEMENTS:
+- Improved PowerDNS config files and directories permissions handling ([\#44](https://github.com/PowerDNS/pdns_recursor-ansible/pull/44))
+
+## v1.2.0 (2019-02-13)
+
+NEW FEATURES:
+- Add some variables to allow to configure the status of the Recursor service ([\#45](https://github.com/PowerDNS/pdns_recursor-ansible/pull/45))
+
+## v1.1.1 (2019-01-29)
+
+BUG FIXES:
+- Fix an issue with the recursor.conf Jinja2 template resulting in the `threads` configuration being rendered wrongly
+
+## v1.1.0 (2018-12-02)
+
+NEW FEATURES:
+- Add an option (`pdns_rec_disable_handlers`) to disable the automated restart of the service on configuration changes ([\#43](https://github.com/PowerDNS/pdns_recursor-ansible/pull/43))
+
+BUG FIXES:
+- Handle correctly the `threads` variable in the PowerDNS Recursor configuration template ([\#41](https://github.com/PowerDNS/pdns_recursor-ansible/pull/41))
+- Ensure that lists are correctly expanded in the PowerDNS Recursor configuration template ([\#42](https://github.com/PowerDNS/pdns_recursor-ansible/pull/42))
+
+## v1.0.0 (2018-07-13)
+
+__BREAKING CHANGES__:
+- Rename the `pdns_rec_lua_config_file_content` variable to `pdns_rec_config_lua_file_content`
+- Rename the `pdns_rec_lua_dns_script_content` variable to `pdns_rec_config_lua_dns_script_file_content`
+
+NEW FEATURES:
+- CI with molecule 2.14.0 ([\#39](https://github.com/PowerDNS/pdns_recursor-ansible/pull/39))
+- Install debuginfo packages ([\#38](https://github.com/PowerDNS/pdns_recursor-ansible/pull/38))
+- Allow to manage systemd overrides ([\#37](https://github.com/PowerDNS/pdns_recursor-ansible/pull/37))
+
+IMPROVEMENTS:
+- Improved documentation ([\#39](https://github.com/PowerDNS/pdns_recursor-ansible/pull/39))
+
+BUG FIXES:
+- Fix the examples in the README file ([\#31](https://github.com/PowerDNS/pdns_recursor-ansible/pull/31))
+- Handle different version string for Debian and CentOS ([\#30](https://github.com/PowerDNS/pdns_recursor-ansible/pull/30))
+
+## v0.1.1 (2017-09-29)
+
+NEW FEATURES:
+- Install specific PowerDNS Recursor versions ([\#29](https://github.com/PowerDNS/pdns_recursor-ansible/pull/29))
+
+IMPROVEMENTS:
+- Add support to the PowerDNS Recursor 4.1.x releases ([\#28](https://github.com/PowerDNS/pdns_recursor-ansible/pull/28))
+- Fixing minor linter issues with whitespace ([\#30](https://github.com/PowerDNS/pdns_recursor-ansible/pull/30))
+
+BUG FIXES:
+- Handle correctly the `include-dir` configuration setting when defined
+
+## v0.1.0 (2017-06-09)
+
+Initial release.
+
+NEW FEATURES:
+- PowerDNS Recursor installation and configuration with Red-Hat and Debian support
+
+IMPROVEMENTS:
+- Switch to the MIT License ([\#27](https://github.com/PowerDNS/pdns_recursor-ansible/pull/27))
+- Overall role refactoring ([\#19](https://github.com/PowerDNS/pdns_recursor-ansible/pull/19))
diff --git a/roles/powerdns.pdns_recursor/LICENSE b/roles/powerdns.pdns_recursor/LICENSE
new file mode 100644
index 0000000..7984329
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 PowerDNS.COM BV
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/roles/powerdns.pdns_recursor/README.md b/roles/powerdns.pdns_recursor/README.md
new file mode 100644
index 0000000..2b3887b
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/README.md
@@ -0,0 +1,227 @@
+# Ansible Role: PowerDNS Recursor
+
+[](https://travis-ci.org/PowerDNS/pdns_recursor-ansible)
+[](https://opensource.org/licenses/MIT)
+[](https://galaxy.ansible.com/PowerDNS/pdns_recursor)
+[](https://github.com/PowerDNS/pdns_recursor-ansible/tags)
+
+An Ansible role created by the folks behind PowerDNS to setup the [PowerDNS Recursor](https://docs.powerdns.com/recursor/).
+
+## Requirements
+
+An Ansible 2.2 or higher installation.
+
+## Dependencies
+
+None.
+
+## Role Variables
+
+Available variables are listed below, along with default values (see `defaults/main.yml`):
+
+```yaml
+pdns_rec_install_repo: ""
+```
+
+By default, the PowerDNS Recursor is installed from the software repositories configured on the target hosts.
+
+```yaml
+# Install the PowerDNS Recursor from the 'master' official repository
+- hosts: pdns-recursors
+ roles:
+ - { role: PowerDNS.pdns_recursor,
+ pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_master }}" }
+
+# Install the PowerDNS Recursor from the '4.0.x' official repository
+- hosts: pdns-recursors
+ roles:
+ - { role: PowerDNS.pdns_recursor,
+ pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_40 }}" }
+
+# Install the PowerDNS Recursor from the '4.1.x' official repository
+- hosts: pdns-recursors
+ roles:
+ - { role: PowerDNS.pdns_recursor,
+ pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_41 }}" }
+```
+
+The examples above, show how to install the PowerDNS Recursor from the official PowerDNS repositories
+(see the complete list of pre-defined repos in `vars/main.yml`).
+
+The roles also supports custom repositories
+
+```yaml
+- hosts: all
+ vars:
+ pdns_rec_install_repo:
+ name: "powerdns-rec" # the name of the repository
+ apt_repo_origin: "repo.example.com" # used to pin the PowerDNS packages to the provided repository
+ apt_repo: "deb http://repo.example.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}/pdns-recursor main"
+ gpg_key: "http://repo.example.com/MYREPOGPGPUBKEY.asc" # repository public GPG key
+ gpg_key_id: "MYREPOGPGPUBKEYID" # to avoid to reimport the key each time the role is executed
+ yum_repo_baseurl: "http://repo.example.com/centos/$basearch/$releasever/pdns-recursor"
+ yum_repo_debug_symbols_baseurl: "http://repo.example.com/centos/$basearch/$releasever/pdns-recursor/debug"
+ roles:
+ - { role: PowerDNS.pdns_recursor }
+```
+
+It is also possible to install the PowerDNS Recursor from custom repositories as demonstrated in the example above.
+
+```yaml
+pdns_rec_install_epel: True
+```
+
+By default, install EPEL to satisfy some PowerDNS Recursor dependencies like `protobuf`.
+To skip the installtion of EPEL set `pdns_rec_install_epel` to `False`.
+
+```yaml
+pdns_rec_package_name: "{{ default_pdns_rec_package_name }}"
+```
+
+The name of the PowerDNS Recursor package, `pdns-recursor` on RedHat-like Debian-like systems.
+
+```yaml
+pdns_rec_package_version: ""
+```
+
+Optionally, allow to set a specific version of the PowerDNS Recursor package to be installed.
+
+```yaml
+pdns_rec_install_debug_symbols_package: False
+```
+
+Install the PowerDNS Recursor debug symbols.
+
+```yaml
+pdns_rec_debug_symbols_package_name: "{{ default_pdns_rec_debug_symbols_package_name }}"
+```
+
+The name of the PowerDNS Recursor debug package to be installed when `pdns_install_debug_symbols_package` is `True`,
+`pdns-recursor-debuginfo` on RedHat-like systems and `pdns-recursor-dbg` on Debian-like systems.
+
+```yaml
+pdns_rec_user: "{{ default_pdns_rec_user }}"
+pdns_rec_group: "{{ default_pdns_rec_group }}"
+```
+
+The user and group the PowerDNS Recursor will run as, `pdns-recursor` on RedHat-like systems and `pdns` on Debian-like systems
+**NOTE**: This role does not create any user or group as we assume that they're created
+by the package or other roles.
+
+```yaml
+pdns_rec_service_name: "pdns_recursor-recursor"
+```
+
+The name of the PowerDNS Recursor service.
+
+```yaml
+pdns_rec_flush_handlers: False
+```
+
+Force the execution of the flushing of the handlers at the end of the role.
+**NOTE:** This is required if using this role to configure multiple recursor instances in a single play
+
+```yaml
+pdns_rec_service_state: "started"
+pdns_rec_service_enabled: "yes"
+```
+
+Allow to specify the desired state of the PowerDNS Recursor service.
+E.g. This allows to install and configure the PowerDNS Recursor without automatically starting the service.
+
+```yaml
+pdns_rec_disable_handlers: False
+```
+
+Disable automated service restart on configuration changes.
+
+```yaml
+pdns_rec_config_dir: "/etc/powerdns"
+pdns_rec_config_file: "recursor.conf"
+```
+
+The PowerDNS Recursor configuration files and directories.
+
+```yaml
+pdns_rec_config: { }
+```
+
+Dictionary containing in YAML format the custom configuration of PowerDNS Recursor.
+**NOTE**: You should not set the `config-dir`, `set-uid` and `set-gid` because are set by other role variables (respectively `pdns_rec_config_dir`, `pdns_rec_user`, `pdns_rec_group`).
+
+```yaml
+pdns_res_config_lua: "{{ pdns_rec_config_dir }}/config.lua"
+pdns_rec_config_lua_file_content: ""
+```
+
+If `pdns_rec_config_lua_file_content` is not `""`, this will dump
+the content of this variable to the `pdns_res_config_lua` file and
+define accordingly the `lua-config-file` setting in the `recursor.conf` configuration file.
+
+```yaml
+pdns_rec_config_dns_script: "{{ pdns_rec_config_dir }}/dns-script.lua"
+pdns_rec_config_dns_script_file_content: ""
+```
+
+If `pdns_rec_config_dns_script_file_content` is not `""`, this will dump
+the content of this variable to the `pdns_rec_config_dns_script` file and
+define accordingly the `lua-dns-script` setting in the `recursor.conf` configuration file.
+
+```yaml
+pdns_rec_service_overrides: {}
+```
+
+Dict with overrides for the service (systemd only).
+This can be used to change any systemd settings in the `[Service]` category
+
+## Example Playbooks
+
+Bind to `203.0.113.53` on port `5300` and allow only traffic from the `198.51.100.0/24` subnet:
+
+```yaml
+- hosts: pdns-recursors
+ vars:
+ pdns_rec_config:
+ allow-from: "198.51.100.0/24"
+ local-address: "203.0.113.53:5300"
+ roles:
+ - { role: PowerDNS.pdns_recursor }
+```
+
+Allow traffic from multiple networks and set some custom ulimits overriding the default systemd service:
+
+```yaml
+- hosts: pdns-recursors
+ vars:
+ pdns_rec_config:
+ allow-from:
+ - "198.51.100.0/24"
+ - "203.0.113.53/24"
+ local-address: "203.0.113.53:5300"
+ pdns_rec_service_overrides:
+ LimitNOFILE: 10000
+ roles:
+ - { role: PowerDNS.pdns_recursor }
+```
+
+## Changelog
+
+A detailed changelog of all the changes applied to the role is available [here](./CHANGELOG.md).
+
+## Testing
+
+Tests are performed by [Molecule](http://molecule.readthedocs.org/en/latest/).
+
+ $ pip install tox
+
+To test all the scenarios run
+
+ $ tox
+
+To run a custom molecule command
+
+ $ tox -e py27-ansible22 -- molecule test -s pdns-rec-41
+
+## License
+
+MIT
diff --git a/roles/powerdns.pdns_recursor/defaults/main.yml b/roles/powerdns.pdns_recursor/defaults/main.yml
new file mode 100644
index 0000000..f6ab2e8
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/defaults/main.yml
@@ -0,0 +1,93 @@
+---
+
+# By default the PowerDNS Recursor is installed from the os default repositories.
+pdns_rec_install_repo: ""
+
+# Install the EPEL repository.
+# EPEL is needed to satisfy some PowerDNS Recursor dependencies like protobuf
+pdns_rec_install_epel: True
+
+# You can install the PowerDNS Recursor package from the 'master' branch as
+# follows:
+# - hosts: all
+# roles:
+# - { role: PowerDNS.pdns_recursor,
+# pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_master }}"
+#
+# To install the PowerDNS Recursor package from the '40' branch of
+# the PowerDNS official repository use the following playbook
+# - hosts: all
+# roles:
+# - { role: PowerDNS.pdns_recursor,
+# pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_40 }}"
+#
+# To install the PowerDNS Recursor package from a custom repository
+# override the `pdns_rec_install_repo` default value in your playbook.
+# e.g.
+# - hosts: all
+# vars:
+# pdns_rec_install_repo:
+# apt_repo_origin: "repo.example.com" # used to pin the pdns-recursor to the provided repository
+# apt_repo: "deb http://repo.example.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}/pdns-recursor main"
+# gpg_key: "http://repo.example.com/MYREPOGPGPUBKEY.asc" # repository public GPG key
+# gpg_key_id: "MYREPOGPGPUBKEYID" # to avoid to reimport the key each time the role is executed
+# yum_repo_baseurl: "http://repo.example.com/centos/$basearch/$releasever/pdns-recursor"
+# yum_debug_symbols_repo_baseurl: "http://repo.example.com/centos/$basearch/$releasever/pdns-recursor/debug"
+# yum_repo_name: "powerdns-rec" # used to select only the pdns-recursor packages coming from this repo
+# roles:
+# - { role: PowerDNS.pdns_recursor }
+
+# The name of the PowerDNS package
+pdns_rec_package_name: "{{ default_pdns_rec_package_name }}"
+pdns_rec_package_version: ""
+
+# Install PowerDNS Recursor debug symbols package
+pdns_rec_install_debug_symbols_package: False
+
+# The name of the PowerDNS Recursor debug symbols package
+pdns_rec_debug_symbols_package_name: "{{ default_pdns_rec_debug_symbols_package_name }}"
+
+# The user and group the PowerDNS Recursor will run as.
+# NOTE: This role does not create any user as we assume the "pdns" user and group
+# to be created by the PowerDNS Recursor package or by an other role.
+# If you change these variables, make sure to create the user and groups before
+# applying this role
+pdns_rec_user: "{{ default_pdns_rec_user }}"
+pdns_rec_group: "{{ default_pdns_rec_group }}"
+
+# Name of the PowerDNS Service
+pdns_rec_service_name: "pdns-recursor"
+
+# Force the execution of the handlers at the end of the role.
+# This is required if using this role to configure multiple recursor instances
+# in a single play to make sure that on configuration changes the correct pnds_recursor
+# instance is restarted.
+pdns_rec_flush_handlers: False
+
+# State of the PowerDNS Recursor service
+pdns_rec_service_state: "started"
+pdns_rec_service_enabled: "yes"
+
+# When True, disable the automated restart of the PowerDNS Recursor service
+pdns_rec_disable_handlers: False
+
+# Configuration directory and files
+pdns_rec_config_dir: "{{ default_pdns_rec_config_dir }}"
+pdns_rec_config_file: "recursor.conf"
+pdns_rec_config_lua: "{{ pdns_rec_config_dir }}/config.lua"
+pdns_rec_config_lua_file_content: ""
+pdns_rec_config_dns_script: "{{ pdns_rec_config_dir }}/dns-script.lua"
+pdns_rec_config_dns_script_file_content: ""
+
+# Dict containing all configuration options, except for the
+# "config-dir", "setuid" and "setgid" directives in YAML format.
+pdns_rec_config: {}
+# pdns_rec_config:
+# allow-from: '127.0.0.1/8,192.168.2.0/24'
+# local-address: 0.0.0.0
+# server-id: 'nothing to see here'
+
+# Dict with overrides for the service (systemd only)
+pdns_rec_service_overrides: {}
+# pdns_rec_service_overrides:
+# LimitNOFILE: 10000
diff --git a/roles/powerdns.pdns_recursor/handlers/main.yml b/roles/powerdns.pdns_recursor/handlers/main.yml
new file mode 100644
index 0000000..e0d40e2
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/handlers/main.yml
@@ -0,0 +1,18 @@
+---
+
+# The sleep in the restart "PowerDNS Recursor handler"
+# is needed to make sure to start correctly the service
+# after stopping it during restarts
+
+- name: restart PowerDNS Recursor
+ service:
+ name: "{{ pdns_rec_service_name }}"
+ state: restarted
+ sleep: 1
+ when: pdns_rec_service_state != 'stopped' and
+ not pdns_rec_disable_handlers
+
+- name: reload systemd and restart PowerDNS Recursor
+ command: systemctl daemon-reload
+ notify: restart PowerDNS Recursor
+ when: not pdns_rec_disable_handlers
diff --git a/roles/powerdns.pdns_recursor/meta/.galaxy_install_info b/roles/powerdns.pdns_recursor/meta/.galaxy_install_info
new file mode 100644
index 0000000..36ad9e5
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/meta/.galaxy_install_info
@@ -0,0 +1,2 @@
+install_date: Fri Dec 6 15:00:35 2019
+version: v1.2.1
diff --git a/roles/powerdns.pdns_recursor/meta/main.yml b/roles/powerdns.pdns_recursor/meta/main.yml
new file mode 100644
index 0000000..3feb3e1
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/meta/main.yml
@@ -0,0 +1,31 @@
+---
+
+galaxy_info:
+ author: PowerDNS Engineering Team
+ description: Install and configure the PowerDNS Recursor
+ company: PowerDNS.COM BV
+ license: MIT
+ min_ansible_version: 2.2
+ platforms:
+ - name: EL
+ versions:
+ - 7
+ - 6
+ - name: Debian
+ versions:
+ - jessie
+ - stretch
+ - name: Ubuntu
+ versions:
+ - trusty
+ - utopic
+ - vivid
+ - wily
+ - xenial
+ - bionic
+ galaxy_tags:
+ - system
+ - dns
+ - pdns
+ - powerdns
+ - pdns-recursor
diff --git a/roles/powerdns.pdns_recursor/molecule/pdns-rec-41/molecule.yml b/roles/powerdns.pdns_recursor/molecule/pdns-rec-41/molecule.yml
new file mode 100644
index 0000000..46329d1
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/pdns-rec-41/molecule.yml
@@ -0,0 +1,73 @@
+---
+
+scenario:
+ name: pdns-rec-41
+
+driver:
+ name: docker
+
+dependency:
+ name: galaxy
+
+platforms:
+ - name: centos-6
+ image: centos:6
+ groups:
+ - pdns-rec
+
+ - name: centos-7
+ image: centos:7
+ dockerfile_tpl: centos-systemd
+ groups:
+ - pdns-rec
+
+ - name: ubuntu-1604
+ image: ubuntu:16.04
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns-rec
+
+ - name: ubuntu-1804
+ image: ubuntu:18.04
+ groups:
+ - pdns-rec
+
+ - name: debian-8
+ image: debian:8
+ groups:
+ - pdns-rec
+
+ - name: debian-9
+ image: debian:9
+ groups:
+ - pdns-rec
+
+provisioner:
+ name: ansible
+ options:
+ diff: True
+ v: True
+ playbooks:
+ create: ../resources/create.yml
+ destroy: ../resources/destroy.yml
+ prepare: ../resources/prepare.yml
+ lint:
+ name: ansible-lint
+ options:
+ # excludes "systemctl used in place of systemd module"
+ x: ["ANSIBLE0006"]
+
+lint:
+ name: yamllint
+
+verifier:
+ name: testinfra
+ options:
+ hosts: pdns-rec
+ vvv: True
+ directory: ../resources/tests/all
+ additional_files_or_dirs:
+ # path relative to 'directory'
+ - ../repo-41/
+ lint:
+ name: flake8
diff --git a/roles/powerdns.pdns_recursor/molecule/pdns-rec-41/playbook.yml b/roles/powerdns.pdns_recursor/molecule/pdns-rec-41/playbook.yml
new file mode 100644
index 0000000..48997de
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/pdns-rec-41/playbook.yml
@@ -0,0 +1,8 @@
+---
+
+- hosts: pdns-rec
+ vars_files:
+ - ../resources/vars/pdns-rec-common.yml
+ - ../resources/vars/pdns-rec-repo-41.yml
+ roles:
+ - { role: pdns_recursor-ansible }
diff --git a/roles/powerdns.pdns_recursor/molecule/pdns-rec-master/molecule.yml b/roles/powerdns.pdns_recursor/molecule/pdns-rec-master/molecule.yml
new file mode 100644
index 0000000..c41a1e1
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/pdns-rec-master/molecule.yml
@@ -0,0 +1,73 @@
+---
+
+scenario:
+ name: pdns-rec-master
+
+driver:
+ name: docker
+
+dependency:
+ name: galaxy
+
+platforms:
+ - name: centos-6
+ image: centos:6
+ groups:
+ - pdns-rec
+
+ - name: centos-7
+ image: centos:7
+ dockerfile_tpl: centos-systemd
+ groups:
+ - pdns-rec
+
+ - name: ubuntu-1604
+ image: ubuntu:16.04
+ dockerfile_tpl: debian-systemd
+ groups:
+ - pdns-rec
+
+ - name: ubuntu-1804
+ image: ubuntu:18.04
+ groups:
+ - pdns-rec
+
+ - name: debian-8
+ image: debian:8
+ groups:
+ - pdns-rec
+
+ - name: debian-9
+ image: debian:9
+ groups:
+ - pdns-rec
+
+provisioner:
+ name: ansible
+ options:
+ diff: True
+ v: True
+ playbooks:
+ create: ../resources/create.yml
+ destroy: ../resources/destroy.yml
+ prepare: ../resources/prepare.yml
+ lint:
+ name: ansible-lint
+ options:
+ # excludes "systemctl used in place of systemd module"
+ x: ["ANSIBLE0006"]
+
+lint:
+ name: yamllint
+
+verifier:
+ name: testinfra
+ options:
+ hosts: pdns-rec
+ vvv: True
+ directory: ../resources/tests/all
+ additional_files_or_dirs:
+ # path relative to 'directory'
+ - ../repo-master/
+ lint:
+ name: flake8
diff --git a/roles/powerdns.pdns_recursor/molecule/pdns-rec-master/playbook.yml b/roles/powerdns.pdns_recursor/molecule/pdns-rec-master/playbook.yml
new file mode 100644
index 0000000..60e291a
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/pdns-rec-master/playbook.yml
@@ -0,0 +1,8 @@
+---
+
+- hosts: pdns-rec
+ vars_files:
+ - ../resources/vars/pdns-rec-common.yml
+ - ../resources/vars/pdns-rec-repo-master.yml
+ roles:
+ - { role: pdns_recursor-ansible }
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.centos-systemd.j2 b/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.centos-systemd.j2
new file mode 100644
index 0000000..74c4fa0
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.centos-systemd.j2
@@ -0,0 +1,26 @@
+# Molecule managed
+
+FROM {{ item.image }}
+
+ENV container docker
+
+# Configure systemd to run into the container (see https://hub.docker.com/_/centos/)
+RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
+rm -f /lib/systemd/system/multi-user.target.wants/*;\
+rm -f /etc/systemd/system/*.wants/*;\
+rm -f /lib/systemd/system/local-fs.target.wants/*; \
+rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
+rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
+rm -f /lib/systemd/system/basic.target.wants/*;\
+rm -f /lib/systemd/system/anaconda.target.wants/*;
+
+# Install sudo and disable requiretty
+RUN yum -y install sudo
+RUN /usr/bin/sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
+
+VOLUME [ "/sys/fs/cgroup" ]
+
+CMD ["/usr/sbin/init"]
+
+RUN if [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf net-tools bash && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl net-tools bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; fi
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.debian-systemd.j2 b/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.debian-systemd.j2
new file mode 100644
index 0000000..0c3845b
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.debian-systemd.j2
@@ -0,0 +1,25 @@
+# Molecule managed
+
+FROM {{ item.image }}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y systemd && apt-get clean; fi
+RUN if [ ! -e /sbin/init ]; then ln -s /lib/systemd/systemd /sbin/init ; fi
+
+ENV container docker
+
+# Don't start the optional systemd services.
+RUN find /etc/systemd/system \
+ /lib/systemd/system \
+ -path '*.wants/*' \
+ -not -name '*journald*' \
+ -not -name '*systemd-tmpfiles*' \
+ -not -name '*systemd-user-sessions*' \
+ -exec rm \{} \;
+
+RUN systemctl set-default multi-user.target
+
+VOLUME [ "/sys/fs/cgroup" ]
+
+CMD ["/sbin/init"]
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash net-tools ca-certificates && apt-get clean; fi
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.default.j2 b/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.default.j2
new file mode 100644
index 0000000..c0847ae
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/Dockerfile.default.j2
@@ -0,0 +1,11 @@
+# Molecule managed
+
+FROM {{ item.image }}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates net-tools && apt-get clean; \
+ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf bash net-tools && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash net-tools && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
+ elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml net-tools && zypper clean -a; \
+ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi
+
+CMD ["sleep", "infinity"]
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/create.yml b/roles/powerdns.pdns_recursor/molecule/resources/create.yml
new file mode 100644
index 0000000..fb001f7
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/create.yml
@@ -0,0 +1,63 @@
+---
+
+- name: Create
+ hosts: localhost
+ connection: local
+ gather_facts: False
+ vars_files:
+ - vars/molecule.yml
+ tasks:
+
+ - set_fact:
+ molecule_service_instances: "{{ molecule_yml.platforms | selectattr('is_service', 'defined') | selectattr('is_service') | list }}"
+ - set_fact:
+ molecule_platform_instances: "{{ molecule_yml.platforms | difference(molecule_service_instances) }}"
+
+ - name: Create Dockerfiles from image names
+ template:
+ src: "Dockerfile.{{ item.dockerfile_tpl | default('default') }}.j2"
+ dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}"
+ with_items: "{{ molecule_platform_instances }}"
+ register: platforms
+
+ - name: Discover local Docker images
+ docker_image_facts:
+ name: "molecule_pdns_rec/{{ item.item.name }}"
+ with_items: "{{ platforms.results }}"
+ register: docker_images
+
+ - name: Build an Ansible compatible image
+ docker_image:
+ path: "{{ molecule_ephemeral_directory }}"
+ name: "molecule_pdns_rec/{{ item.item.image }}"
+ dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
+ force: "{{ item.item.force | default(True) }}"
+ with_items: "{{ platforms.results }}"
+ when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0
+
+ - name: Create molecule instance(s)
+ docker_container:
+ name: "{{ item.name }}"
+ hostname: "{{ item.name }}"
+ image: "{{ item.image }}"
+ state: started
+ recreate: False
+ env: "{{ item.env | default(omit) }}"
+ privileged: "no"
+ volumes: "{{ item.volumes | default(omit) }}"
+ with_items: "{{ molecule_service_instances }}"
+
+ - name: Create the required Services instance(s)
+ docker_container:
+ name: "{{ item.name }}"
+ hostname: "{{ item.name }}"
+ image: "molecule_pdns_rec/{{ item.image }}"
+ links: "{{ molecule_service_instances | map(attribute='name') | list }}"
+ command: "{{ item.command | default(omit) }}"
+ state: started
+ recreate: False
+ privileged: "yes"
+ volumes:
+ # Mount the cgroups fs to allow SystemD to run into the containers
+ - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
+ with_items: "{{ molecule_platform_instances }}"
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/destroy.yml b/roles/powerdns.pdns_recursor/molecule/resources/destroy.yml
new file mode 100644
index 0000000..7f39803
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/destroy.yml
@@ -0,0 +1,15 @@
+---
+
+- name: Destroy the Molecule Test Resources
+ hosts: localhost
+ connection: local
+ gather_facts: False
+ vars_files:
+ - vars/molecule.yml
+ tasks:
+ - name: Destroy the target Platforms instance(s)
+ docker_container:
+ name: "{{ item.name }}"
+ state: absent
+ force_kill: "{{ item.force_kill | default(True) }}"
+ with_items: "{{ molecule_yml.platforms }}"
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/prepare.yml b/roles/powerdns.pdns_recursor/molecule/resources/prepare.yml
new file mode 100644
index 0000000..87f7078
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/prepare.yml
@@ -0,0 +1,18 @@
+---
+
+- name: Prepare the Molecule Test Resources
+ hosts: pdns-rec
+ tasks:
+ # Install rsyslog to capture the PowerDNS Recursor log messages
+ # when the service is not managed by systemd
+ - block:
+ - name: Install rsyslog
+ package:
+ name: rsyslog
+ state: present
+
+ - name: Start rsyslog
+ service:
+ name: rsyslog
+ state: started
+ when: ansible_facts.service_mgr != 'systemd'
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/tests/all/test_common.py b/roles/powerdns.pdns_recursor/molecule/resources/tests/all/test_common.py
new file mode 100644
index 0000000..7a7ab6e
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/tests/all/test_common.py
@@ -0,0 +1,90 @@
+import os
+import yaml
+import pytest
+import testinfra.utils.ansible_runner
+
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+@pytest.fixture()
+def AnsibleVars(host):
+ varsFiles = ["../../vars/main.yml"]
+ if host.system_info.distribution.lower() in debian_os:
+ varsFiles.append("../../vars/Debian.yml")
+ if host.system_info.distribution.lower() in rhel_os:
+ varsFiles.append("../../vars/RedHat.yml")
+
+ ansibleVars = {}
+ for f in varsFiles:
+ with open(f, 'r') as stream:
+ ansibleVars.update(yaml.load(stream))
+
+ return ansibleVars
+
+
+def test_distribution(host):
+ assert host.system_info.distribution.lower() in debian_os + rhel_os
+
+
+def test_repo_pinning_file(host):
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/preferences.d/pdns-recursor')
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+ f.contains('Package: pdns-recursor')
+ f.contains('Pin: origin repo.powerdns.com')
+ f.contains('Pin-Priority: 600')
+
+
+def test_package(host):
+ p = host.package('pdns-recursor')
+ assert p.is_installed
+
+
+def test_service(host):
+ # Using Ansible to mitigate some issues with the service test on debian-8
+ s = host.ansible('service', 'name=pdns-recursor state=started enabled=yes')
+ assert s["changed"] is False
+
+
+def test_config(host, AnsibleVars):
+ with host.sudo():
+ fc = fr = None
+ if host.system_info.distribution.lower() in debian_os:
+ fc = host.file('/etc/powerdns/recursor.conf')
+ fr = host.file('/etc/powerdns/rpz.lua')
+ if host.system_info.distribution.lower() in rhel_os:
+ fc = host.file('/etc/pdns-recursor/recursor.conf')
+ fr = host.file('/etc/pdns-recursor/rpz.lua')
+
+ assert fc.exists
+ assert fc.user == 'root'
+ assert fc.group == AnsibleVars['default_pdns_rec_group']
+ assert oct(fc.mode) == '0640'
+ assert 'lua-config-file=' + fr.path in fc.content
+ assert 'allow-from=127.0.0.0/24,127.0.1.0/24,2001:DB8:10::/64' in \
+ fc.content
+
+ assert fr.exists
+ assert fr.user == 'root'
+ assert fr.group == AnsibleVars['default_pdns_rec_group']
+ assert oct(fr.mode) == '0640'
+
+
+def systemd_override(host):
+ smgr = host.ansible("setup")["ansible_facts"]["ansible_service_mgr"]
+ if smgr == 'systemd':
+ fname = '/etc/systemd/system/pdns-recursor.service.d/override.conf'
+ f = host.file(fname)
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+ assert 'LimitCORE=infinity' in f.content
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/tests/repo-41/test_repo_41.py b/roles/powerdns.pdns_recursor/molecule/resources/tests/repo-41/test_repo_41.py
new file mode 100644
index 0000000..0057fdf
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/tests/repo-41/test_repo_41.py
@@ -0,0 +1,32 @@
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+def test_repo_file(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-rec-41.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-rec-41.repo')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+
+
+def test_pdns_repo(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-rec-41.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-rec-41.repo')
+
+ assert f.exists
+ assert f.contains('rec-41')
+
+
+def test_pdns_version(host):
+ cmd = host.run('/usr/sbin/pdns_recursor --version')
+
+ assert 'PowerDNS Recursor 4.1.' in cmd.stderr
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/tests/repo-master/test_repo_master.py b/roles/powerdns.pdns_recursor/molecule/resources/tests/repo-master/test_repo_master.py
new file mode 100644
index 0000000..759d9c9
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/tests/repo-master/test_repo_master.py
@@ -0,0 +1,32 @@
+
+debian_os = ['debian', 'ubuntu']
+rhel_os = ['redhat', 'centos']
+
+
+def test_repo_file(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-rec-master.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-rec-master.repo')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
+
+
+def test_pdns_repo(host):
+ f = None
+ if host.system_info.distribution.lower() in debian_os:
+ f = host.file('/etc/apt/sources.list.d/powerdns-rec-master.list')
+ if host.system_info.distribution.lower() in rhel_os:
+ f = host.file('/etc/yum.repos.d/powerdns-rec-master.repo')
+
+ assert f.exists
+ assert f.contains('rec-master')
+
+
+def test_pdns_version(host):
+ cmd = host.run('/usr/sbin/pdns_recursor --version')
+
+ assert 'PowerDNS Recursor 0.0.' in cmd.stderr
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/vars/molecule.yml b/roles/powerdns.pdns_recursor/molecule/resources/vars/molecule.yml
new file mode 100644
index 0000000..298c000
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/vars/molecule.yml
@@ -0,0 +1,6 @@
+---
+
+molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
+molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
+molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
+molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-common.yml b/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-common.yml
new file mode 100644
index 0000000..2dd623e
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-common.yml
@@ -0,0 +1,38 @@
+---
+
+##
+# PowerDNS Recursor Configuration
+##
+
+pdns_rec_config:
+
+ # Listen Address
+ local-address: "127.0.0.1"
+ local-port: "53"
+
+ # Embedded webserver
+ webserver: yes
+ webserver-address: "0.0.0.0"
+ webserver-port: "8001"
+ api-key: "powerdns"
+
+ # Let the kernel do the distribution of queries
+ pdns-distributes-queries: "no"
+ reuseport: "yes"
+
+ # We need more mthreads to handle huge traffic load
+ threads: 5
+ max-mthreads: 8192
+
+ # This tests that we expand lists to comma-separated configuration items
+ allow-from:
+ - 127.0.0.0/24
+ - 127.0.1.0/24
+ - '2001:DB8:10::/64'
+
+pdns_rec_config_lua: "{{ pdns_rec_config_dir }}/rpz.lua"
+pdns_rec_config_lua_file_content: |
+ rpzMaster("127.0.0.2", "rpz.test", {refresh=30})
+
+pdns_rec_service_overrides:
+ LimitCORE: infinity
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-repo-41.yml b/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-repo-41.yml
new file mode 100644
index 0000000..1da3cdc
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-repo-41.yml
@@ -0,0 +1,7 @@
+---
+
+##
+# PowerDNS Recursor 4.1.x Repository
+##
+
+pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_41 }}"
diff --git a/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-repo-master.yml b/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-repo-master.yml
new file mode 100644
index 0000000..e7fbcae
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/molecule/resources/vars/pdns-rec-repo-master.yml
@@ -0,0 +1,7 @@
+---
+
+##
+# PowerDNS Recursor Master Repository
+##
+
+pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_master }}"
diff --git a/roles/powerdns.pdns_recursor/tasks/configure.yml b/roles/powerdns.pdns_recursor/tasks/configure.yml
new file mode 100644
index 0000000..82080a9
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/tasks/configure.yml
@@ -0,0 +1,83 @@
+---
+
+- block:
+
+ - name: Ensure the override directory exists (systemd)
+ file:
+ name: "/etc/systemd/system/{{ pdns_rec_service_name }}.service.d"
+ state: directory
+ owner: root
+ group: root
+
+ - name: Override the PowerDNS Recursor unit (systemd)
+ template:
+ src: "override-service.systemd.conf.j2"
+ dest: "/etc/systemd/system/{{ pdns_rec_service_name }}.service.d/override.conf"
+ owner: root
+ group: root
+ notify: reload systemd and restart PowerDNS Recursor
+
+ when: pdns_rec_service_overrides != {}
+ and ansible_facts.service_mgr == "systemd"
+
+- name: Ensure that the PowerDNS Recursor configuration directory exists
+ file:
+ name: "{{ pdns_rec_config_dir }}"
+ state: directory
+ owner: root
+ group: root
+ mode: 0755
+
+- name: Generate the PowerDNS Recursor configuration
+ template:
+ src: recursor.conf.j2
+ dest: "{{ pdns_rec_config_dir }}/{{ pdns_rec_config_file }}"
+ owner: "root"
+ group: "{{ pdns_rec_group }}"
+ mode: 0640
+ notify: restart PowerDNS Recursor
+
+- name: Ensure that the PowerDNS Recursor 'include-dir' directory exists
+ file:
+ name: "{{ pdns_rec_config['include-dir'] }}"
+ state: directory
+ owner: "root"
+ group: "root"
+ mode: 0755
+ when: "pdns_rec_config['include-dir'] is defined"
+
+- name: Enable Syslog logging for PowerDns Recursors
+ lineinfile:
+ path: /usr/lib/systemd/system/pdns-recursor.service
+ regexp: 'disable-syslog'
+ line: "ExecStart=/usr/sbin/pdns_recursor --daemon=no --write-pid=no --log-timestamp=no"
+ become: true
+ become_method: sudo
+ notify: reload systemd and restart PowerDNS Recursor
+
+- name: Configure syslog log rotation
+ template:
+ src: syslogrotate.conf.j2
+ dest: "/etc/logrotate.d/syslog"
+ become: true
+ become_method: sudo
+
+- name: Generate the PowerDNS Recursor Lua config-file
+ copy:
+ dest: "{{ pdns_rec_config_lua }}"
+ content: "{{ pdns_rec_config_lua_file_content }}"
+ owner: "root"
+ group: "{{ pdns_rec_group }}"
+ mode: 0640
+ notify: restart PowerDNS Recursor
+ when: pdns_rec_config_lua_file_content != ""
+
+- name: Generate PowerDNS Recursor Lua dns-script
+ copy:
+ dest: "{{ pdns_rec_config_dns_script }}"
+ content: "{{ pdns_rec_config_dns_script_file_content }}"
+ owner: "root"
+ group: "{{ pdns_rec_group }}"
+ mode: 0640
+ notify: restart PowerDNS Recursor
+ when: pdns_rec_config_dns_script_file_content != ""
diff --git a/roles/powerdns.pdns_recursor/tasks/install.yml b/roles/powerdns.pdns_recursor/tasks/install.yml
new file mode 100644
index 0000000..0132d5a
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/tasks/install.yml
@@ -0,0 +1,26 @@
+---
+
+- block:
+
+ - name: Prefix the version of the PowerDNS Recursor package with the correct separator on RedHat
+ set_fact:
+ _pdns_rec_package_version: "-{{ pdns_rec_package_version }}"
+ when: ansible_facts.os_family == 'RedHat'
+
+ - name: Prefix the version of the PowerDNS Recursor package with the correct separator on Debian
+ set_fact:
+ _pdns_rec_package_version: "={{ pdns_rec_package_version }}"
+ when: ansible_facts.os_family == 'Debian'
+
+ when: pdns_rec_package_version != ''
+
+- name: Install the PowerDNS Recursor
+ package:
+ name: "{{ pdns_rec_package_name }}{{ _pdns_rec_package_version | default('') }}"
+ state: present
+
+- name: Install PowerDNS Recursor debug symbols
+ package:
+ name: "{{ pdns_rec_debug_symbols_package_name }}{{ _pdns_rec_package_version | default('') }}"
+ state: present
+ when: pdns_rec_install_debug_symbols_package
diff --git a/roles/powerdns.pdns_recursor/tasks/main.yml b/roles/powerdns.pdns_recursor/tasks/main.yml
new file mode 100644
index 0000000..e96ce10
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/tasks/main.yml
@@ -0,0 +1,32 @@
+---
+
+- name: Include OS-specific variables
+ include_vars: "{{ ansible_facts.os_family }}.yml"
+ tags:
+ - always
+
+- include: "repo-{{ ansible_facts.os_family }}.yml"
+ when: pdns_rec_install_repo != ""
+ tags:
+ - install
+ - repository
+
+- include: install.yml
+ tags:
+ - install
+
+- include: configure.yml
+ tags:
+ - config
+
+- name: Set the status of the PowerDNS Recursor service
+ service:
+ name: "{{ pdns_rec_service_name }}"
+ state: "{{ pdns_rec_service_state }}"
+ enabled: "{{ pdns_rec_service_enabled }}"
+ tags:
+ - service
+
+- name: Force handlers flush
+ meta: flush_handlers
+ when: pdns_rec_flush_handlers
diff --git a/roles/powerdns.pdns_recursor/tasks/repo-Debian.yml b/roles/powerdns.pdns_recursor/tasks/repo-Debian.yml
new file mode 100644
index 0000000..3ace11f
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/tasks/repo-Debian.yml
@@ -0,0 +1,33 @@
+---
+
+- name: Install gnupg
+ package:
+ name: gnupg
+ state: present
+
+- name: Import the PowerDNS Recursor APT Repository key
+ apt_key:
+ url: "{{ pdns_rec_install_repo['gpg_key'] }}"
+ id: "{{ pdns_rec_install_repo['gpg_key_id'] | default('') }}"
+ state: present
+ register: _pdns_rec_apt_key
+
+- name: Add the PowerDNS Recursor APT Repository
+ apt_repository:
+ filename: "{{ pdns_rec_install_repo['name'] }}"
+ repo: "{{ pdns_rec_install_repo['apt_repo'] }}"
+ state: present
+ register: _pdns_rec_apt_repo
+
+- name: Update the APT cache
+ apt:
+ update_cache: yes
+ when: "_pdns_rec_apt_key.changed or _pdns_rec_apt_repo.changed"
+
+- name: Pin the PowerDNS Recursor APT Repository
+ template:
+ src: pdns-recursor.pin.j2
+ dest: /etc/apt/preferences.d/pdns-recursor
+ owner: root
+ group: root
+ mode: 0644
diff --git a/roles/powerdns.pdns_recursor/tasks/repo-RedHat.yml b/roles/powerdns.pdns_recursor/tasks/repo-RedHat.yml
new file mode 100644
index 0000000..bd7ef35
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/tasks/repo-RedHat.yml
@@ -0,0 +1,46 @@
+---
+
+- block:
+
+ - name: Install epel-release on CentOS
+ yum:
+ name: epel-release
+ state: present
+ when: ansible_facts.distribution in [ 'CentOS' ]
+
+ - name: Install epel-release on RHEL/OracleLinux
+ yum:
+ name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm"
+ state: present
+ when: ansible_facts.distribution in [ 'RedHat', 'OracleLinux' ]
+
+ when: pdns_rec_install_epel
+
+- name: Install yum-plugin-priorities
+ package:
+ name: yum-plugin-priorities
+ state: present
+ when: ansible_facts.distribution in [ 'CentOS' ]
+
+- name: Add the PowerDNS Recursor YUM Repository
+ yum_repository:
+ name: "{{ pdns_rec_install_repo['name'] }}"
+ file: "{{ pdns_rec_install_repo['name'] }}"
+ description: PowerDNS Recursor
+ baseurl: "{{ pdns_rec_install_repo['yum_repo_baseurl'] }}"
+ gpgkey: "{{ pdns_rec_install_repo['gpg_key'] }}"
+ gpgcheck: yes
+ priority: 90
+ state: present
+
+- name: Add the PowerDNS Recursor debug symbols YUM Repository
+ yum_repository:
+ name: "{{ pdns_rec_install_repo['name'] }}-debuginfo"
+ file: "{{ pdns_rec_install_repo['name'] }}"
+ description: PowerDNS Recursor - debug symbols
+ baseurl: "{{ pdns_rec_install_repo['yum_debug_symbols_repo_baseurl'] }}"
+ gpgkey: "{{ pdns_rec_install_repo['gpg_key'] }}"
+ gpgcheck: yes
+ priority: 90
+ state: present
+ when: pdns_rec_install_debug_symbols_package
diff --git a/roles/powerdns.pdns_recursor/templates/override-service.systemd.conf.j2 b/roles/powerdns.pdns_recursor/templates/override-service.systemd.conf.j2
new file mode 100644
index 0000000..1952be4
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/templates/override-service.systemd.conf.j2
@@ -0,0 +1,4 @@
+[Service]
+{% for k, v in pdns_rec_service_overrides.items() %}
+{{ k }}={{ v }}
+{% endfor %}
diff --git a/roles/powerdns.pdns_recursor/templates/pdns-recursor.pin.j2 b/roles/powerdns.pdns_recursor/templates/pdns-recursor.pin.j2
new file mode 100644
index 0000000..fd5522a
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/templates/pdns-recursor.pin.j2
@@ -0,0 +1,3 @@
+Package: {{ pdns_rec_package_name }}
+Pin: origin {{ pdns_rec_install_repo['apt_repo_origin'] }}
+Pin-Priority: 600
diff --git a/roles/powerdns.pdns_recursor/templates/recursor.conf.j2 b/roles/powerdns.pdns_recursor/templates/recursor.conf.j2
new file mode 100644
index 0000000..df0db8a
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/templates/recursor.conf.j2
@@ -0,0 +1,29 @@
+config-dir={{ pdns_rec_config_dir }}
+setuid={{ pdns_rec_user }}
+setgid={{ pdns_rec_group }}
+
+{% for config_item, value in pdns_rec_config.items() | sort() %}
+{% if config_item not in ["config-dir", "setuid", "setgid"] %}
+{% if config_item == 'threads' %}
+{{ config_item }}={{ value | string }}
+{% elif value == True %}
+{{ config_item }}=yes
+{% elif value == False %}
+{{ config_item }}=no
+{% elif value is string %}
+{{ config_item }}={{ value | string }}
+{% elif value is sequence %}
+{{ config_item }}={{ value | join(',') }}
+{% else %}
+{{ config_item }}={{ value | string }}
+{% endif %}
+{% endif %}
+{% endfor %}
+
+{% if pdns_rec_config_lua_file_content != "" %}
+lua-config-file={{ pdns_rec_config_lua }}
+{% endif %}
+
+{% if pdns_rec_config_dns_script_file_content != "" %}
+lua-dns-script={{ pdns_rec_config_dns_script }}
+{% endif %}
diff --git a/roles/powerdns.pdns_recursor/templates/syslogrotate.conf.j2 b/roles/powerdns.pdns_recursor/templates/syslogrotate.conf.j2
new file mode 100644
index 0000000..d796fbd
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/templates/syslogrotate.conf.j2
@@ -0,0 +1,24 @@
+/var/log/messages
+{
+ maxsize 1G
+ create 600 root root
+ rotate 8
+ daily
+ compress
+ missingok
+ sharedscripts
+ postrotate
+ /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
+ endscript
+}
+/var/log/cron
+/var/log/maillog
+/var/log/secure
+/var/log/spooler
+{
+ missingok
+ sharedscripts
+ postrotate
+ /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
+ endscript
+}
\ No newline at end of file
diff --git a/roles/powerdns.pdns_recursor/test-requirements.txt b/roles/powerdns.pdns_recursor/test-requirements.txt
new file mode 100644
index 0000000..5aad8de
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/test-requirements.txt
@@ -0,0 +1,2 @@
+molecule==2.14.0
+docker-py==1.10.6
diff --git a/roles/powerdns.pdns_recursor/tox.ini b/roles/powerdns.pdns_recursor/tox.ini
new file mode 100644
index 0000000..49d478f
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/tox.ini
@@ -0,0 +1,20 @@
+[tox]
+minversion = 1.8
+envlist = py{27}-ansible{25,26,27}
+skipsdist = true
+
+[travis:env]
+ANSIBLE=
+ 2.5: ansible25
+ 2.6: ansible26
+ 2.7: ansible27
+
+[testenv]
+passenv = *
+deps =
+ -rtest-requirements.txt
+ ansible25: ansible<2.6
+ ansible26: ansible<2.7
+ ansible27: ansible<2.8
+commands =
+ {posargs:molecule test --all --destroy always}
diff --git a/roles/powerdns.pdns_recursor/vars/Debian.yml b/roles/powerdns.pdns_recursor/vars/Debian.yml
new file mode 100644
index 0000000..e784632
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/vars/Debian.yml
@@ -0,0 +1,6 @@
+---
+
+default_pdns_rec_user: "pdns"
+default_pdns_rec_group: "pdns"
+default_pdns_rec_config_dir: "/etc/powerdns"
+default_pdns_recorsor_debug_symbols_package_name: "pdns-recursor-dbg"
diff --git a/roles/powerdns.pdns_recursor/vars/RedHat.yml b/roles/powerdns.pdns_recursor/vars/RedHat.yml
new file mode 100644
index 0000000..8aa0723
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/vars/RedHat.yml
@@ -0,0 +1,6 @@
+---
+
+default_pdns_rec_user: "pdns-recursor"
+default_pdns_rec_group: "pdns-recursor"
+default_pdns_rec_config_dir: "/etc/pdns-recursor"
+default_pdns_rec_debug_symbols_package_name: "pdns-recursor-debuginfo"
diff --git a/roles/powerdns.pdns_recursor/vars/main.yml b/roles/powerdns.pdns_recursor/vars/main.yml
new file mode 100644
index 0000000..f3c55b5
--- /dev/null
+++ b/roles/powerdns.pdns_recursor/vars/main.yml
@@ -0,0 +1,30 @@
+---
+
+default_pdns_rec_package_name: "pdns-recursor"
+
+pdns_rec_powerdns_repo_master:
+ apt_repo_origin: "repo.powerdns.com"
+ apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release | lower }}-rec-master main"
+ gpg_key: "http://repo.powerdns.com/CBC8B383-pub.asc"
+ gpg_key_id: "D47975F8DAE32700A563E64FFF389421CBC8B383"
+ yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/rec-master"
+ yum_debug_symbols_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/rec-master/debug"
+ name: "powerdns-rec-master"
+
+pdns_rec_powerdns_repo_40:
+ apt_repo_origin: "repo.powerdns.com"
+ apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release | lower }}-rec-40 main"
+ gpg_key: "http://repo.powerdns.com/FD380FBB-pub.asc"
+ gpg_key_id: "9FAAA5577E8FCF62093D036C1B0C6205FD380FBB"
+ yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/rec-40"
+ yum_debug_symbols_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/rec-40/debug"
+ name: "powerdns-rec-40"
+
+pdns_rec_powerdns_repo_41:
+ apt_repo_origin: "repo.powerdns.com"
+ apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release | lower }}-rec-41 main"
+ gpg_key: "http://repo.powerdns.com/FD380FBB-pub.asc"
+ gpg_key_id: "9FAAA5577E8FCF62093D036C1B0C6205FD380FBB"
+ yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/rec-41"
+ yum_debug_symbols_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/rec-41/debug"
+ name: "powerdns-rec-41"
diff --git a/roles/rapid7/defaults/main.yml b/roles/rapid7/defaults/main.yml
new file mode 100644
index 0000000..7a258ca
--- /dev/null
+++ b/roles/rapid7/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+Rapid7Dir: /opt/rapid7
+Rapid7_install_script: Rapid7Insight_Agent_Installer.sh
+...
diff --git a/roles/rapid7/files/README.md b/roles/rapid7/files/README.md
new file mode 100644
index 0000000..b90e88d
--- /dev/null
+++ b/roles/rapid7/files/README.md
@@ -0,0 +1,4 @@
+# Where to store files
+Here is a place to put files used by the roles.
+
+You can also put them in the default ansibles "files" directory (files folder aside of playbook files)
diff --git a/roles/rapid7/tasks/main.yml b/roles/rapid7/tasks/main.yml
new file mode 100644
index 0000000..8201d5a
--- /dev/null
+++ b/roles/rapid7/tasks/main.yml
@@ -0,0 +1,21 @@
+- name: Ensure directory exists
+ file:
+ path: "{{ Rapid7Dir }}"
+ state: directory
+
+- name: Copy Agent installer in host
+ copy:
+ src: "{{ Rapid7_install_script }}"
+ dest: "{{ Rapid7Dir }}/{{ Rapid7_install_script }}"
+ mode: '0550'
+
+- name: Run installer script
+ shell: "{{ Rapid7Dir }}/{{ Rapid7_install_script }} install --token {{ R7Token }}"
+ args:
+ creates: "{{ Rapid7Dir }}/ir_agent"
+
+- name: Enable and start service
+ service:
+ name: ir_agent
+ state: started
+ enabled: yes