【问题标题】:Using Ansible Clouldformation module to provision a CoreOS cluster使用 Ansible Cloudformation 模块配置 CoreOS 集群
【发布时间】:2014-10-31 22:54:26
【问题描述】:

我是 Ansible 的新手,如果我想从本地配置集群,我不确定我的主机文件是什么样的。我的yaml文件如下:

---
- hosts: coreos
  tasks:
    - name: Automation CoreOS Cluster
      action: cloudformation >
        stack_name="automation_ansible_coreos_cluster" state=present
        region=us-east-1 disable_rollback=true
        template=files/coreos-stable-pv.template
      args:
        template_parameters:
          InstanceType: m1.small
          ClusterSize: 3
          DiscoveryURL: 'https://discovery.etcd.io/<val>'
          KeyPair: Automation
      tags:
        Stack: ansible-cloudformation-coreos

我们将不胜感激。

【问题讨论】:

    标签: ansible ansible-playbook amazon-cloudformation coreos


    【解决方案1】:

    将剧本转换为如下所示:

    ---
    - hosts: localhost
      connection: local
      gather_facts: false
      tasks:
      - name: Automation CoreOS Cluster
        cloudformation: stack_name='automation_ansible_coreos_cluster' state=present region='us-east-1' disable_rollback=true template='files/coreos-stable-pv.template'
        args:
          template_parameters:
            InstanceType: m1.small
            ClusterSize: 3
            DiscoveryURL: 'https://discovery.etcd.io/<val>'
            KeyPair: Automation
        register: stack
        tags:
          Stack: ansible-cloudformation-coreos
    

    将主机设置为localhost 并连接到local 将解决您的问题,添加gather_facts: false 将跳过从库存文件收集信息并继续配置您的机器,从而解决查找机器的需要(尚未创建!)

    此外,您还需要具有足够访问权限的 AWS 用户凭证来执行相关操作

    【讨论】:

      【解决方案2】:

      以下工作

      剧本:

      ---
      - hosts: coreos
        connection: local
        tasks:
        - name: Automation CoreOS Cluster
          cloudformation: stack_name='automation-ansible-coreos-cluster' state=present region='us-east-1'         disable_rollback=true template='files/coreos-stable-pv.template'
          args:
            template_parameters:
              InstanceType: t1.micro
              ClusterSize: 3
              DiscoveryURL: 'https://discovery.etcd.io/<val>'
              KeyPair: Automation
          register: stack
          tags:
              Stack: ansible-cloudformation-coreos
      

      主机文件:

      [coreos]
      host1
      host2
      host3
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-01-05
        • 2023-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-11
        • 1970-01-01
        相关资源
        最近更新 更多