Add --container-enabled option to ansible-galaxy init command. (#18157)

This commit is contained in:
Chris Houseknecht 2016-10-27 22:16:22 -04:00 committed by GitHub
commit d60bc492b6
23 changed files with 251 additions and 104 deletions

View file

@ -0,0 +1,46 @@
language: python
dist: trusty
sudo: required
services:
- docker
before_install:
- sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports universe'
- sudo apt-get update -qq
- sudo apt-get install -y -o Dpkg::Options::="--force-confold" --force-yes docker-engine
install:
# Install the latest Ansible Container and Ansible
- pip install git+https://github.com/ansible/ansible-container.git
- pip install ansible
script:
# Make sure docker is functioning
- docker version
- docker-compose version
- docker info
# Create an Ansible Container project
- mkdir -p tests
- cd tests
- ansible-container init
# Install the role into the project
- echo "Installing and testing git+https://github.com/${TRAVIS_REPO_SLUG},${TRAVIS_COMMIT}"
- ansible-container install git+https://github.com/${TRAVIS_REPO_SLUG},${TRAVIS_COMMIT}
# Build the service image
- ansible-container build
# Start the service
- ansible-container run -d
- docker ps
# Run tests
- ansible-playbook test.yml
notifications:
email: false
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View file

@ -0,0 +1,49 @@
# Role Name
Adds a <SERVICE_NAME> service to your [Ansible Container](https://github.com/ansible/ansible-container) project. Run the following commands
to install the service:
```
# Set the working directory to your Ansible Container project root
$ cd myproject
# Install the service
$ ansible-container install <USERNAME.ROLE_NAME>
```
## Requirements
- [Ansible Container](https://github.com/ansible/ansible-container)
- An existing Ansible Container project. To create a project, simply run the following:
```
# Create an empty project directory
$ mkdir myproject
# Set the working directory to the new directory
$ cd myproject
# Initialize the project
$ ansible-contiainer init
```
- Continue listing any prerequisites here...
## 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.
## License
BSD
## Author Information
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View file

@ -0,0 +1,3 @@
---
# defaults file for {{ role_name }}

View file

@ -0,0 +1,2 @@
---
# handlers file for {{ role_name }}

View file

@ -0,0 +1,11 @@
# Add your Ansible Container service definitions here.
# For example:
#
# web:
# image: ubuntu:trusty
# ports:
# - "80:80"
# command: ['/usr/bin/dumb-init', '/usr/sbin/apache2ctl', '-D', 'FOREGROUND']
# dev_overrides:
# environment:
# - "DEBUG=1"

View file

@ -0,0 +1,56 @@
galaxy_info:
author: {{ author }}
description: {{ description }}
company: {{ company }}
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: {{ issue_tracker_url }}
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: {{ license }}
min_ansible_container_version: 0.2.0
# If Ansible is required outside of the build container, provide the minimum version:
# min_ansible_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:
#
# Below are all platforms currently available in Galaxy. Uncomment any that match the base images
# of the services defined in meta/container.yml
#
#platforms:
{%- for platform,versions in platforms.items() %}
#- name: {{ platform }}
# versions:
# - all
{%- for version in versions %}
# - {{ version }}
{%- endfor -%}
{%- endfor %}
galaxy_tags:
- container
# 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.
#
# 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.

View file

@ -0,0 +1,3 @@
---
# tasks file for {{ role_name }}

View file

@ -0,0 +1,2 @@
[defaults]
inventory=./inventory

View file

@ -0,0 +1,3 @@
localhost

View file

@ -0,0 +1,8 @@
---
- hosts: localhost
gather_facts: no
connection: local
tasks:
# Add tasks and assertions for testing the service here.

View file

@ -0,0 +1,3 @@
---
# vars file for {{ role_name }}