Florian Dambrine
I am a Freelance DevOps Engineer graduated from UTC (University of Technology of Compiègne) in 2014. I am a DevOps enthusiast embracing Cloud computing technologies to build automated infrastructure at large scale.
@DambrineF
Florian Dambrine - Senior DevOps Engineer - @ GumGum
Florian Dambrine
DevOps Engineer @ GumGum
Joined GumGum 5 years ago
Ansible fan!
Invented In-Image
advertising in 2008
 ~/Workspace/ops/ansible ● tree -L 2 -I '*.yaml'
.
├── ansible.cfg
├── <playbook>.yml
├── inventories/
│   ├── ireland
│   │   ├── ec2.ini
│   │   ├── ec2.py
│   │   └── group_vars
│   ├── japan
│   │   ├── ec2.ini
│   │   ├── ec2.py
│   │   └── group_vars
│   ├── oregon
│   │   ├── ec2.ini
│   │   ├── ec2.py
│   │   └── group_vars
│   └── virginia
│   │   ├── ec2.ini
│   │   ├── ec2.py
│   │   └── group_vars
├── library/
├── requirements.yml
└── roles/
    └── ...
...
### About 200 ansible roles
├── roles
│   ├── PHPCi-001
│   ├── activemq-001
│   ├── ad-server-001
│   ├── advertising-api-001
│   ├── ansible-001
│   ├── ansible-metadata-001
│   ├── apt-cacher-ng-001
│   ├── aws-api-server-002
│   ├── aws-cli-001
│   ├── aws-mon-linux-001
│   ├── bid-predictor-001
│   ├── bid-predictor-002
│   ├── bower-001
│   ├── caffe-on-spark-001
│   ├── cassandra-001
│   ├── cassandra-002
│   ├── cassandra-cleanup-001
│   ├── cassandra-clearsnapshot-001
│   ├── cassandra-compaction-001
│   ├── cassandra-firewall-001
│   ├── cassandra-repair-001
│   ├── cassandra-rolling-restart-001
│   ├── cloudfront-origin-001
│   ├── codedeploy-001
│   ├── collectd-001
│   ├── common-001
...├── ansible-role-aws-cli├── ansible-role-common├── ansible-role-elasticsearch├── ansible-role-gradle├── ansible-role-groovy├── ansible-role-java...
ansible-ops
ansible-data-engineering
ansible-web-engineering
ansible-data-science
def getPlaybookList() {
    playbooks = [
        "queue-processor-001.yaml",
        "cron-001.yaml",
        "geo-server-003.yaml",
        "redis-001.yaml",
        "reporting-server-001.yaml",
        "taskrunner-001.yaml",
        "tomcat-001.yaml"
        "s3s3mirror-001.yaml",
        "spark-001.yaml"
    ]
    playbooks ? playbooks : null
}
for each $playbook
for the $role
Molecule provides a simple framework for easily and repeatedly testing your roles and playbooks against different environments and operating systems
$ pip install moleculedocker run --rm -it \
    -v '$(pwd)':/tmp/$(basename "${PWD}"):ro \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -w /tmp/$(basename "${PWD}") \
    quay.io/ansible/molecule:latest \
    sudo molecule test<rolename>
├── README.md
├── defaults
│   └── main.yml
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── molecule
│   └── default
│       ├── Dockerfile.j2
│       ├── INSTALL.rst
│       ├── create.yml
│       ├── destroy.yml
│       ├── molecule.yml
│       ├── playbook.yml
│       ├── prepare.yml
│       └── tests
│           └── test_default.py
├── tasks
│   └── main.yml
└── vars
    └── main.yml
Molecule internals
Developer files
LintersDependenciesDriversVerifiersgoss
lint:
  name: yamllint
dependency:
  name: galaxy
  options:
    role-file: ${PWD}/requirements.yml
driver:
  name: docker
platforms:
  - name: ubuntu_trusty
    image: ubuntu:trusty
    ...
  - name: ubuntu_xenial
    image: solita/ubuntu-systemd:xenial
    ...provisioner:
  name: ansible
  config_options:
    defaults:
      callback_whitelist: timer
  inventory:
    links:
      group_vars: ../inventory/group_vars/
  lint:
    name: ansible-lint
    enabled: true
scenario:
  name: default
  converge_sequence:
    - dependency
    - create
    - prepare
    - converge
    - idempotence
verifier:
  name: testinfra
  lint:
    name: flake8
scenario:
  name: default
  create_sequence:
    - create
    - prepare
  check_sequence:
    - destroy
    - dependency
    - create
    - prepare
    - converge
    - check
    - destroy
  converge_sequence:
    - dependency
    - create
    - prepare
    - converge
  destroy_sequence:
    - destroy
  test_sequence:
    - lint
    - destroy
    - dependency
    - syntax
    - create
    - prepare
    - converge
    - idempotence
    - side_effect
    - verify
    - destroycommand
sequence
$ molecule init template --url \
    https://github.com/Lowess/ansible-role-cookiecutter--> Initializing new role role_name...
role_name [role_name]: meetup-demo
role_description [TODO]: Cookiecutter is awesome !
role_author [Your Name]: Florian Dambrine
min_ansible_version [2.0]: 2.2
Initialized role in /tmp/tmp/role_name successfully.$ tree ansible-role-meetup-demo -L 2
ansible-role-meetup-demo
├── .ansible-lint
├── .drone.yml
├── .gitignore
├── .pre-commit-config.yml
├── .yamllint
├── README.md
├── defaults
│   └── main.yml
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── molecule
│   ├── default
│   ├── inventory
│   └── resources
├── tasks
│   ├── cleanup.yml
│   ├── configure.yml
│   ├── main.yml
│   └── test.yml
└── vars
    └── main.ymldocker run --rm -it \
    -v '$(pwd)':/tmp/$(basename "${PWD}"):ro \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -w /tmp/$(basename "${PWD}") \
    quay.io/ansible/molecule:latest \
    sudo molecule testgumsible testTest containers managed by Molecule
quay.io/ansible/molecule
lowess/drone-molecule
Missing git+ssh (PR #1604)
Latest Ansible version only
Drone CI plugin
Offers git+ssh (private repos)
Offers multiple Ansible versions
Extra ansible-lint rules
Mitogen plugin available
# .drone.yml
---
kind: pipeline
name: ansible-ci
workspace:
  base: /drone
  path: src/${DRONE_REPO}
steps:
  - name: molecule
    image: lowess/drone-molecule:2.6.8
    environment:
      CI_UUID: _2.6_${DRONE_COMMIT_SHA:0:8}
      ANSIBLE_STRATEGY: mitogen_linear
    pull: true
    settings:
      task: test
    volumes:
      - name: dockersock
        path: /var/run/docker.sock
  - name: galaxy
    image: lowess/drone-molecule:2.6.8
    environment:
      GALAXY_TOKEN:
        from_secret: ansible_galaxy_token
    commands:
      - ansible-galaxy login --github-token $GALAXY_TOKEN
      - ansible-galaxy import \
          $DRONE_REPO_NAMESPACE $DRONE_REPO_NAME
volumes:
  - name: dockersock
    host:
      path: /var/run/docker.sock
/var/run/docker.sock
Let's start building a better galaxy, one molecule at a time...
Mitogen is a Python library for writing distributed self-replicating programs. [...] An extension to Ansible is included that implements connections over Mitogen, replacing embedded shell invocations with pure-Python equivalents invoked via highly efficient remote procedure calls to persistent interpreters tunnelled over SSH.
Expect a 1.25x - 7x speedup and a CPU usage reduction of at least 2x.
By Florian Dambrine
I am a Freelance DevOps Engineer graduated from UTC (University of Technology of Compiègne) in 2014. I am a DevOps enthusiast embracing Cloud computing technologies to build automated infrastructure at large scale.