簡體   English   中英

使用Ansible Clouldformation模塊配置CoreOS集群

[英]Using Ansible Clouldformation module to provision a CoreOS cluster

我是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

任何建議將被認真考慮。

將劇本轉換為以下形式:

---
- 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

將host設置為localhost並連接到local將解決您的問題,並增加了gather_facts: false將跳過從清單文件中收集信息,並繼續配置您的機器,從而解決了尋找機器(尚未創建的機器)的需求!)

此外,您將需要具有足夠訪問權限的AWS用戶憑證才能執行相關操作

以下工作

劇本:

---
- 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM