CompTIA Linux+ XK0-006 (V8) Practice Question

In a mixed automation workflow, you provision infrastructure with OpenTofu and occasionally run one-off Ansible ad-hoc commands such as:

ansible webservers -m yum -a 'name=httpd state=latest'

After accidentally deleting the file terraform.tfstate, OpenTofu is unable to calculate a new plan, but the Ansible command still executes successfully. What fundamental difference in the way the two tools manage state explains this behavior?

  • OpenTofu keeps a persistent state file to record the resources it manages, whereas Ansible ad-hoc commands evaluate the hosts on each run and do not maintain a separate state file.

  • Deleting terraform.tfstate removed the SSH keys required by OpenTofu, whereas Ansible uses HTTPS instead of SSH and therefore continued to work.

  • Both tools rely on state files, but OpenTofu stores its state remotely by default and Ansible locally, so only OpenTofu was affected when the local file was removed.

  • OpenTofu discards resource metadata after every apply, while Ansible stores host state in /var/lib/ansible/state.json and reloads it on the next run.

CompTIA Linux+ XK0-006 (V8)
Automation, Orchestration, and Scripting
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot