Remove the leading - character on the - hosts line.
On Tue, Aug 24, 2021, 13:59 Tony Wong <[email protected]> wrote:
> ok so here is what i have
>
> s3_bucket.yml
>
> ---
> - hosts: localhost
> name: create s3 bucket
> become: yes
>
> roles:
> - s3_bucket
>
> ------------------------------------------------
>
> roles
> └── s3_bucket
> ├── README.md
> ├── defaults
> │ └── main.yml
> ├── handlers
> │ └── main.yml
> ├── meta
> │ └── main.yml
> ├── tasks
> │ └── main.yml
> ├── templates
> ├── tests
> │ ├── inventory
> │ └── test.yml
> └── vars
> └── main.yml
>
>
> I only filled out tasks/main.yml and vars/main.yml
>
> tasks/main.yml
>
> ---
> - hosts: localhost
> tasks:
> - name: create s3 bucket
> s3_bucket:
> name: '{{ s3_bucket_name }}'
> public_access:
> block_public_acls: true
> ignore_public_acls: true
> block_public_policy: true
> restrict_public_buckets: true
> state: present
> encryption: "aws:kms"
> encryption_key_id: '{{ kms_arn_id }}'
> region: us-west-1
> versioning: yes
> tags:
> atomenv: '{{ s3_tag.atomenv }}'
> atomos: '{{ s3_tag_atomos }}'
> atomrole: '{{ s3_tag.atomrole }}'
> atompid: '{{ s3_tag.atompid }}'
> atomdomain: '{{ s3_tag.atomdomain }}'
>
>
> vars/main.yml
>
> ---
> # vars file for s3_bucket
> s3_bucket_name: ansibletest12345
> kms_arn.id:
> arn:aws:kms:us-west-1:462518063038:key/f164e76a-f6f8-4773-84dc-053a44b2678d
> s3_tag.atomenv: prod
> s3_tag.atomos: s3 bucket
> s3_tag.atomrole: util
> s3_tag.atompid: 32
> s3_tag.atomdomain: active.tan
>
>
>
> but then when i ran
>
> ansible-playbook -vvvv s3_bucket.yml
>
> ERROR! conflicting action statements: hosts, tasks
>
> The error appears to be in
> '/Users/tonywong/virtualenv/ansible/roles/s3_bucket/tasks/main.yml': line
> 2, column 3, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
> ---
> - hosts: localhost
> ^ here
>
>
>
> any idea?
> On Tuesday, August 24, 2021 at 4:50:22 AM UTC-7 Tony Wong wrote:
>
>> i want to reuse the role. i only want to modify the variables for future
>> use
>>
>> On Tuesday, August 24, 2021 at 1:03:10 AM UTC-7 [email protected] wrote:
>>
>>> Did you read the reply?
>>>
>>> What do you want to achieve?
>>> What is the intention?
>>> Why do you say "break this play up into roles/tasks/variables etc."?
>>>
>>>
>>>
>>> On Tue, 24 Aug 2021 at 06:01, Tony Wong <[email protected]> wrote:
>>> >
>>> > my variables are
>>> >
>>> > ansibletestbucket12345
>>> >
>>> arn:aws:kms:us-west-1:462518063038:key/f164e76a-f6f8-4773-84dc-053a44b2678d
>>> > prod
>>> > s3 bucket
>>> > util
>>> > 32
>>> > atomdomain
>>> >
>>> >
>>> >
>>> > On Monday, August 23, 2021 at 7:07:36 AM UTC-7 Brian Coca wrote:
>>> >>
>>> >> you are showing a playbook with a single task and no variables, there
>>> >> is not much to break up here
>>> >>
>>> >> On Fri, Aug 20, 2021 at 4:58 PM Tony Wong <[email protected]> wrote:
>>> >> >
>>> >> > how do I break this play up into roles/tasks/variables etc....
>>> >> >
>>> >> >
>>> >> > ---
>>> >> > - hosts: localhost
>>> >> > tasks:
>>> >> > - name: create s3 bucket
>>> >> > s3_bucket:
>>> >> > name: ansibletestbucket12345
>>> >> > public_access:
>>> >> > block_public_acls: true
>>> >> > ignore_public_acls: true
>>> >> > block_public_policy: true
>>> >> > restrict_public_buckets: true
>>> >> > state: present
>>> >> > encryption: "aws:kms"
>>> >> > encryption_key_id:
>>> "arn:aws:kms:us-west-1:462518063038:key/f164e76a-f6f8-4773-84dc-053a44b2678d"
>>>
>>> >> > region: us-west-1
>>> >> > versioning: yes
>>> >> > tags:
>>> >> > atomenv: prod
>>> >> > atomos: s3 bucket
>>> >> > atomrole: util
>>> >> > atompid: 32
>>> >> > atomdomain: xxxxx
>>> >> >
>>> >> > --
>>> >> > You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> >> > To unsubscribe from this group and stop receiving emails from it,
>>> send an email to [email protected].
>>> >> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/eb897354-e82b-4d8e-bdb0-a9fe32f048f0n%40googlegroups.com.
>>>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> ----------
>>> >> Brian Coca
>>> >>
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/cd76041a-6d57-493e-97a4-bd1760f8ad7dn%40googlegroups.com.
>>>
>>>
>>>
>>>
>>> --
>>> Dick Visser
>>> Trust & Identity Service Operations Manager
>>> GÉANT
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1dde8393-dd30-4fa0-a963-06608e679cafn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/1dde8393-dd30-4fa0-a963-06608e679cafn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAFtje5O35MWouiU1g9AGZFtdOeUFpM4A%2BfXq%3DfEuOUXup0LOJg%40mail.gmail.com.