diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/README.md b/README.md index e984367..90c23f4 100644 --- a/README.md +++ b/README.md @@ -1 +1,32 @@ -# ansible-role-docker +ansible-role-docker +========= + +This role installs and configures the docker. + +Requirements +------------ + +Ubuntu 16.04 Xenial Xerus + +Role Variables +-------------- + + +Dependencies +------------ + + +Example Playbook +---------------- + + - hosts: servers + roles: + - { role: chirkin.ansible-role-docker } + +License +------- + +BSD + +Author Information +------------------ diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..130865a --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: daemon-reload + command: 'systemctl daemon-reload' + +- name: restart docker + service: + name: docker + state: restarted diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..278ec3d --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,19 @@ +galaxy_info: + author: a4irkin + description: Ansible docker role + + license: license (GPLv2, CC-BY, etc) + + min_ansible_version: 1.2 + + - name: Ubuntu + versions: + - xenial + + galaxy_tags: + - docker + - linux + - xenial + - installer + +dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..e8ae0e5 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,33 @@ +--- +- name: add docker repo apt key + apt_key: + keyserver=p80.pool.sks-keyservers.net + id=58118E89F3A912897C070ADBF76221572C52609D + state=present + +- name: add docker repository + apt_repository: + repo="deb https://apt.dockerproject.org/repo ubuntu-xenial main" + update_cache=yes + +- name: install docker + apt: name=docker-engine + +- name: create /etc/systemd/system/docker.service.d directory + file: + dest=/etc/systemd/system/docker.service.d + recurse=yes + state=directory + +- name: uploads docker configuration file + template: + src: 'docker/docker.conf.j2' + dest: '/etc/systemd/system/docker.service.d/docker.conf' + notify: + - 'daemon-reload' + - 'restart docker' + +- name: install docker-py + pip: name=docker-py + +- meta: flush_handlers diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..d18580b --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..7935c86 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ansible-role-docker diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..a38c5fb --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for .