Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install error (Linux, AWS) #42

Closed
MakaryGo opened this issue Sep 3, 2021 · 6 comments
Closed

Install error (Linux, AWS) #42

MakaryGo opened this issue Sep 3, 2021 · 6 comments

Comments

@MakaryGo
Copy link

MakaryGo commented Sep 3, 2021

Describe the bug
When trying to set it up according to the instructions, it crashes at step

fatal: [forem]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: list object has no element 0

    The error appears to be in '/home/makarygo/selfhost/playbooks/providers/aws.yml': line 48, column 5, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:


      - name: Set forem_vpc_id fact
        ^ here

To Reproduce
ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml

OS (please complete the following information):

  • Linux

Cloud Provider (please complete the following information):

  • AWS
@jdoss
Copy link
Contributor

jdoss commented Sep 7, 2021

Task step looks for a default VPC https://github.com/forem/selfhost/blob/main/playbooks/providers/aws.yml#L41-L50. If you deleted the default one it will be blank and fail.

You can comment lines 41 to 50:

- amazon.aws.ec2_vpc_net_info:
      filters:
        "isDefault": "true"
      region: "{{ fcos_aws_region }}"
      profile: "{{ fcos_aws_profile }}"
    register: forem_vpc_info

  - name: Set forem_vpc_id fact
    ansible.builtin.set_fact:
      forem_vpc_id: "{{ forem_vpc_info['vpcs'][0]['vpc_id'] }}"

and then just pass in the VPC ID (replace vpc-1212233445566 in the example below with your AWS VPC ID) from your account in the region you are using via an extra var:

ansible-playbook -i inventory/forem/setup.yml playbooks/providers/aws.yml -e forem_vpc_id=vpc-1212233445566

or use a region that still has a default VPC present.

@MakaryGo
Copy link
Author

MakaryGo commented Sep 7, 2021

It seemed to help, after changing region in /playbook/providers/aws.yml
Only now it crashes at another step:

TASK [Launch Forem instance for <redacted>] **********************************************************************
fatal: [forem]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: No first item, sequence was empty.

    The error appears to be in '/home/makarygo/selfhost/playbooks/providers/aws.yml': line 170, column 5, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:


      - name: "Launch Forem instance for {{ app_domain }}"
        ^ here
    We could be wrong, but this one looks like it might be an issue with
    missing quotes. Always quote template expression brackets when they
    start a value. For instance:

        with_items:
          - {{ foo }}

    Should be written as:

        with_items:
          - "{{ foo }}"

@jdoss
Copy link
Contributor

jdoss commented Sep 7, 2021

I think it is having issues because vpc_subnet_id: "{{ forem_subnet_info.subnets | map(attribute='id') | list | first }}" expects a list of subnets.

- name: Gather info about VPC subnets
    amazon.aws.ec2_vpc_subnet_info:
      filters:
        vpc-id: "{{ forem_vpc_id }}"
        availability-zone: "{{ fcos_aws_region }}a"
      region: "{{ fcos_aws_region }}"
      profile: "{{ fcos_aws_profile }}"
    register: forem_subnet_info

Should get that info but if your VPC that you are using doesn't have any subnets that most likely is a problem.

Debugging your AWS account is a bit beyond our scope here so I would see if you have a default VPC on this account in this region and if not, recreate it https://aws.amazon.com/premiumsupport/knowledge-center/deleted-default-vpc/ and just use the default one if you can't figure out what is going on with your subnets on your current AWS VPC.

@MakaryGo
Copy link
Author

MakaryGo commented Sep 7, 2021

Yeah, I used this AWS account log time ago for deployment of different project, I will try to deploy with other provider. Thanks for assistance and sorry for stupid questions, just never worked with Ansible before.

@jdoss
Copy link
Contributor

jdoss commented Sep 7, 2021

No worries and no problem @MakaryGo. I think if you just tried a different region in AWS and make sure you have a default VPC you will be off the to the races.

@jdoss
Copy link
Contributor

jdoss commented Sep 10, 2021

Hey @MakaryGo I am going to close this request for now. If you want, you can post on https://forem.dev any issues you are having with your VPC on your AWS account and maybe the community can offer more advice.

@jdoss jdoss closed this as completed Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@jdoss @MakaryGo and others