From 53521f0e93a865536ffc73b456d33d25c3a69f83 Mon Sep 17 00:00:00 2001 From: Oliver Davies <oliver@oliverdavies.uk> Date: Thu, 2 May 2019 18:14:53 +0100 Subject: [PATCH] init --- .yamllint | 11 +++++ README.md | 48 ++++++++++++++++++++ defaults/main.yml | 2 + handlers/main.yml | 2 + meta/main.yml | 58 ++++++++++++++++++++++++ molecule/default/Dockerfile.j2 | 14 ++++++ molecule/default/INSTALL.rst | 22 +++++++++ molecule/default/molecule.yml | 18 ++++++++ molecule/default/playbook.yml | 5 ++ molecule/default/tests/test_default.py | 14 ++++++ molecule/default/tests/test_default.pyc | Bin 0 -> 1129 bytes tasks/main.yml | 2 + vars/main.yml | 2 + 13 files changed, 198 insertions(+) create mode 100644 .yamllint create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 molecule/default/Dockerfile.j2 create mode 100644 molecule/default/INSTALL.rst create mode 100644 molecule/default/molecule.yml create mode 100644 molecule/default/playbook.yml create mode 100644 molecule/default/tests/test_default.py create mode 100644 molecule/default/tests/test_default.pyc create mode 100644 tasks/main.yml create mode 100644 vars/main.yml diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..ad0be76 --- /dev/null +++ b/.yamllint @@ -0,0 +1,11 @@ +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable + truthy: disable diff --git a/README.md b/README.md new file mode 100644 index 0000000..555d701 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should +be mentioned here. For instance, if the role uses the EC2 module, it may be a +good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including +any variables that are in defaults/main.yml, vars/main.yml, and any variables +that can/should be set via parameters to the role. Any variables that are read +from other roles and/or the global scope (ie. hostvars, group vars, etc.) should +be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in +regards to parameters that may need to be set for other roles, or variables that +are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables +passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: opdavies.drupal-settings, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a +website (HTML is not allowed). diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..336678f --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for opdavies.drupal-settings diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..90858c5 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for opdavies.drupal-settings diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..ba43fdd --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,58 @@ +--- +galaxy_info: + author: your name + description: your description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Some suggested licenses: + # - BSD (default) + # - MIT + # - GPLv2 + # - GPLv3 + # - Apache + # - CC-BY + license: license (GPLv2, CC-BY, etc) + + min_ansible_version: 1.2 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # Optionally specify the branch Galaxy will use when accessing the GitHub + # repo for this role. During role install, if no tags are available, + # Galaxy will use this branch. During import Galaxy will access files on + # this branch. If Travis integration is configured, only notifications for this + # branch will be accepted. Otherwise, in all cases, the repo's default branch + # (usually master) will be used. + # github_branch: + + # + # platforms is a list of platforms, and each platform has a name and a list of versions. + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] +# List your role dependencies here, one per line. Be sure to remove the '[]' above, +# if you add dependencies to this list. diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 new file mode 100644 index 0000000..e6aa95d --- /dev/null +++ b/molecule/default/Dockerfile.j2 @@ -0,0 +1,14 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi diff --git a/molecule/default/INSTALL.rst b/molecule/default/INSTALL.rst new file mode 100644 index 0000000..6a44bde --- /dev/null +++ b/molecule/default/INSTALL.rst @@ -0,0 +1,22 @@ +******* +Docker driver installation guide +******* + +Requirements +============ + +* Docker Engine + +Install +======= + +Please refer to the `Virtual environment`_ documentation for installation best +practices. If not using a virtual environment, please consider passing the +widely recommended `'--user' flag`_ when invoking ``pip``. + +.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ +.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site + +.. code-block:: bash + + $ pip install 'molecule[docker]' diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..65faca2 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,18 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: + name: yamllint +platforms: + - name: instance + image: centos:7 +provisioner: + name: ansible + lint: + name: ansible-lint +verifier: + name: testinfra + lint: + name: flake8 diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml new file mode 100644 index 0000000..673d26e --- /dev/null +++ b/molecule/default/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: opdavies.drupal-settings diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py new file mode 100644 index 0000000..eedd64a --- /dev/null +++ b/molecule/default/tests/test_default.py @@ -0,0 +1,14 @@ +import os + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_hosts_file(host): + f = host.file('/etc/hosts') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' diff --git a/molecule/default/tests/test_default.pyc b/molecule/default/tests/test_default.pyc new file mode 100644 index 0000000000000000000000000000000000000000..982560deef278f60065e4e1a6ed68d3706ece713 GIT binary patch literal 1129 zcmZSn%*%D><*Art1}I==U|?`yU|=ZrVqjoMVPHsMWXNG)h=Q{j8KRgNQkfXCm>IHI z7_wLyQW+Ss*cein7$ln+8M4?JQkWT<85yED7*bdmS{N9jI6+1PYp^mfFl7G!|Np;V zi8uoTgRj4jt8=K2YrLmln5$oie^6w+o2QR!3CQ}yoSbAv1_lNuD0T)p$A^J|p@xAW z3+$q1Muu8Oh8jkOEJlW6IffD@h9(G?8RU>`CWc~TBtaIKpa)big@GYh17wq5F&6^^ zgMMmBvVKN>aY=Cr3j+f~QGR|2*tuX{T4qja2^#|gLuy4PNCh7Q1A}96acWUXW`3S) zQBi&oSXn7Z1mwr`qWsbV4Up5p;vi#7K%Pm{00l6ZDE<qww4f-nEU_e2zbvsxKP^8e zCAFwnza&ZDq{PA`yPzn~#4yPsJ3HIJEG<2+&>}t8z`(#DJx@PGzaX<fH#4ueBrzvP zH^(i-%*j<hH$Nvexilvg!AQ=}&(2IuE-fiZEz&PePR&a!%FNd<OD)Pw%S<iOFG(#f z$;?YDO4P5eMpmi^GbuhLvnVyWB)_P#wiaCt%((cx#N1R&X_zG_Mu04gPf1NnEX^s= zE2u2tXJB9ei-E$YI35(poS<0d00j~wKNCNrD5C}_Zc0EQnO|HY2h{*}wO(mSW=^qQ zVqS4(Qch}oQE6UYYEcQu0FaqrB_*J^04pm2#Tc4WUQi@LbO%8+vx8zduPn1DKM!nB zdTL2L*llp9f{lfU1%X@!j!FbE8mT3q$g|1KPbtkwwF4#jVvqn26Au#)qa-r`!|+Ni literal 0 HcmV?d00001 diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..7e18612 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,2 @@ +--- +# tasks file for opdavies.drupal-settings diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..19e6394 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for opdavies.drupal-settings