Coder Social home page Coder Social logo

rancher_ansible's Introduction

Rancher Modules

Ansible Modules for Rancher

An Ansible Collection providing modules for interfacing with Rancher.

Contains the following modules:

  • rancher_cluster for creating, deleting, and gathering information about custom clusters
  • rancher_node for cordoning, draining, and uncordoning nodes

Example Usage

Importing The Collection

ansible-galaxy collection install seancallaway.rancher

Using the Modules

rancher_cluster

- hosts: localhost
  gather_facts: no
  tasks:
  - name: Create Cluster
    rancher_cluster:
      name: test-cluster
      description: Test Cluster Created with Ansible
      rancher_url: https://rancher.mydomain.com
      api_bearer_key: token-fg3ea:asdfimnoaqipnweron92u09jpqvijw490aqwekmowipcn
      network_plugin: canal
      state: present
    register: test_cluster

Note that the activation command (minus the --worker, --etcd, or --controlplane flags) is returned as registration_token.

The following shows a more complete example of the usage of the rancher_cluster module including all optional parameters:

- hosts: localhost
  gather_facts: no
  tasks:
  - name: Create rancher cluster including optional parameters
    rancher_cluster:
      name: test-cluster2
      description: Another test cluster created via Ansible
      rancher_url: https://rancher.mydomain.com
      api_bearer_key: token-xyz:abcdefg0123456789
      network_plugin: calico
      agentImageOverride: my-org/my-image
      desiredAgentImage: my-org/my-image
      desiredAuthImage: my-org/my-image
      dockerRootDir: /var/lib/docker
      enableClusterAlerting: True
      enableClusterMonitoring: True
      ignore_docker_version: True
      validate_certs: True
      labels:
        mylabel: Value
        other_label: Value
      annotations:
        first_annotation: "Value"
        second_annotation: "Another value"

rancher_node

- hosts: localhost
  gather_facts: no
  tasks:
  - name: Cordon Node
    rancher_node:
      name: worker01
      rancher_url: https://rancher.mydomain.com
      api_bearer_key: token-fg3ea:asdfimnoaqipnweron92u09jpqvijw490aqwekmowipcn
      state: cordoned
  - name: Drain Node
    rancher_node:
      name: worker03
      rancher_url: https://rancher.mydomain.com
      api_bearer_key: token-fg3ea:asdfimnoaqipnweron92u09jpqvijw490aqwekmowipcn
      force: true
      deleteLocalData: true
      state: drained
  - name: Uncordon Node
    rancher_node:
      name: worker01
      rancher_url: https://rancher.mydomain.com
      api_bearer_key: token-fg3ea:asdfimnoaqipnweron92u09jpqvijw490aqwekmowipcn
      state: uncordoned

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.