diff --git a/.molecule/group_vars/all b/.molecule/group_vars/all deleted file mode 100644 index b5dce2f7aeb7225bea7a972bcb406ba3cca1b26d..0000000000000000000000000000000000000000 --- a/.molecule/group_vars/all +++ /dev/null @@ -1,3 +0,0 @@ -five: 5 -six: 6 -eleven: '{{ five + six }}' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6274aa01b223aa43f1be946e2da2470f5d90e446..e6b7fc91a863347569ebf3b72156c251ac8ff49b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,3 +10,8 @@ sha: 94b506c144d4e22ebc1deef637a818db13bcaca5 hooks: - id: ansible-pre-commit +- repo: https://github.com/willthames/ansible-lint.git + sha: v3.3.3 + hooks: + - id: ansible-lint + files: \.(yaml|yml)$ diff --git a/README.rst b/README.rst index a80cdd5521132f8113052395100a178dc794bae8..e132861304a875ed2b4a4a45935bb5492789bfcc 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ To install the dependencies: .. code:: shell - ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) + ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles To run the full test suite: diff --git a/ansible.cfg b/ansible.cfg index e9ff55d11e12f188e2f551060e6d149e870a10bd..10b3da5cfa1edbc2186229872bd129f0e34222c8 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,6 +1,6 @@ [defaults] host_key_checking = False retry_files_enabled = False -roles_path = .molecule/roles:../ +roles_path = roles:../:../../:.molecule/roles command_warnings = True deprecation_warnings = True diff --git a/tasks/main.yml b/tasks/main.yml index 0e6270bd454057c98decb0e06e1953d6c44533a8..8746192472fd2670963d3333141b9725c91d1400 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,30 +1,10 @@ --- -# tasks file for ansible-role-openbsd-bootstrap - -- name: Install Python - raw: "PKG_PATH={{ openbsd_pkg_mirror }}/OpenBSD/$(uname -r)/packages/$(arch -s)/ /usr/sbin/pkg_add -Iz python-2.7" - register: openbsd_pkg_add_python - failed_when: "'error' in openbsd_pkg_add_python.stdout|lower" - changed_when: "'py-pip' in openbsd_pkg_add_python.stdout" - tags: - - skip_ansible_lint - -- name: Gather facts - setup: - -- name: Symlink python - file: - path: /usr/bin/python - src: /usr/local/bin/python2.7 - state: link - owner: root - group: 0 - mode: 0o0755 - -- name: Configure pkg - lineinfile: - dest: /etc/pkg.conf - line: 'installpath = {{ openbsd_pkg_mirror }}/OpenBSD/{{ ansible_distribution_release }}/packages/{{ ansible_architecture }}/' - regexp: '^installpath =' - state: present - create: yes +# tasks file for ansible-role-debian-bootstrap +- name: Update APT sources + raw: DEBIAN_FRONTEND=noninteractive apt-get update + changed_when: False + +- name: APT install Python + raw: DEBIAN_FRONTEND=noninteractive apt-get install -qy python2.7 python + register: debian_bootstrap_install_python + changed_when: "'Unpacking' in debian_bootstrap_install_python.stdout" diff --git a/tests/test_example.py b/tests/test_example.py new file mode 100644 index 0000000000000000000000000000000000000000..12d4c7a5294fc8128e8ae695e8afaaa62a002f9b --- /dev/null +++ b/tests/test_example.py @@ -0,0 +1,7 @@ +def test_example(Command): + assert Command('uname').rc == 0 + + +def test_root(Command, Sudo): + with Sudo(): + assert Command('whoami').stdout == 'root'