簡體   English   中英

帶有ansible的重定向規則S3

[英]Redirection rules S3 with ansible

我對 ansible 和 awscli 很陌生。 我試圖扮演一個角色來創建一個存儲桶作為帶有索引的網站。 一切正常,但我還想創建重定向規則。

使用 aws cli 命令,例如:

 - name: Create Bucket
   command: aws s3api create-bucket --bucket myskroto --acl public-read-write  --create-bucket-configuration LocationConstraint=eu-west-1
   become: yes

我能夠創建所需的任務,但在 ansible 中我收到有關查找 bucket.js 文件的錯誤。 我應該把這個文件放在哪里?

 Unable to load paramfile file://bucket.js: [Errno 2] No such file or directory: 'bucket.js'"

Tring 而不是使用像這樣的 asnible 模塊:

- name: Configure an s3 bucket as a website with index and error pages
  s3_website:
    name: myskroto
    suffix: index.html
    error_key: errors/404.htm
    state: present

一切正常,但我無法填充重定向規則。 我可以使用哪個參數?

謝謝:)

解決了。 問題只是我調用的是 bucket.js 而不是 bucket.json。 一切都是固定的。 我將文件放在同一個 main.yml 根目錄中。

test_ansible_roles/
├── bucket.json
├── ec2instances
│   ├── README.md
│   ├── defaults
│   │   └── main.yml
│   ├── handlers
│   │   └── main.yml
│   ├── meta
│   │   └── main.yml
│   ├── tasks
│   │   └── main.yml
│   ├── tests
│   │   ├── inventory
│   │   └── test.yml
│   └── vars
│       └── main.yml
├── main.yml
└── s3bucket
    ├── README.md
    ├── defaults
    │   └── main.yml
    ├── handlers
    │   └── main.yml
    ├── meta
    │   └── main.yml
    ├── tasks
    │   └── main.yml
    ├── tests
    │   ├── inventory
    │   └── test.yml
    └── vars
        └── main.yml

暫無
暫無

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

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