Ansible-playbook cannot read inventory file hosts.yaml when run inside Github Actions

I’m doing a migration from Jenkins into Github actions, and a lot of the automations I’m running a re using ansible playbooks. The ansible needs an inventory file to determine hosts and vars under them. However, when attempting to run said ansible automation in github actions, I get the following error:

 Warning: :  * Failed to parse /__w/aws-infra/aws-
infra/inventories/hosts.yaml with auto plugin: no root 'plugin' key found,
'/__w/aws-infra/aws-infra/inventories/hosts.yaml' is not a
valid YAML inventory plugin config file
Warning: :  * Failed to parse /__w/aws-infra/aws-
infra/inventories/hosts.yaml with yaml plugin: We were unable to read either as
JSON nor YAML, these are the errors we got from each: JSON: Expecting property
name enclosed in double quotes: line 1 column 25 (char 24)  Syntax Error while
loading YAML.   did not find expected ',' or '}'  The error appears to be in
'<string>': line 2, column 40, but may be elsewhere in the file depending on
the exact syntax problem.
Warning: :  * Failed to parse /__w/aws-infra/aws-
infra/inventories/hosts.yaml with ini plugin: We were unable to read either as
JSON nor YAML, these are the errors we got from each: JSON: Expecting property
name enclosed in double quotes: line 1 column 25 (char 24)  Syntax Error while
loading YAML.   did not find expected ',' or '}'  The error appears to be in
'<string>': line 2, column 40, but may be elsewhere in the file depending on
the exact syntax problem.
Warning: : Unable to parse /__w/aws-infra/aws-
infra/inventories/hosts.yaml as an inventory source
Warning: : No inventory was parsed, only implicit localhost is available
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting property name enclosed in double quotes: line 1 column 25 (char 24)

My step inside the pipeline goes as follows:

- name: run ansible
  run: |
    ansible-playbook -i ./inventories/hosts.yaml 
    ./create_cluster.yaml

Any help on the topic is much appriciated. If I had to guess at this point, it’s failing because some permission thing inside the container. I’m running this on my custom ubuntu-based dockerfile that’s build into ghcr and pulled at the beginning of the pipeline. The image contains everything that was used for running this inside Jenkins.

What has been tried so far:

  • Bumped ancient ansible version to latest
  • Run the ‘hosts.yaml’ trough yamllint, ansible-lint
  • Run ansible-inventory –graph inside gha with success
  • Raised pipeline permissions to write-all
  • Tried different paths such as ${{ github.workspace }}/, ./ and simple path for the inventory file.
  • Exhausted a lot of stackoverflow threads and google results.

Expected result: ansible reads inventory and starts running as normal.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật